Delphi XE5的移动项目中对象已经是生存期自管理的了

Delphi XE5的移动项目中对象已经是生存期自管理的了
TTest = class
protected
destructor Destroy; override;

public
procedure BeforeDestruction; override;

end;

procedure TTest.BeforeDestruction;
begin
inherited;
ShowMessage(‘TTest.BeforeDestruction’);
end;

destructor TTest.Destroy;
begin
ShowMessage(‘TTest.Destroy’);
inherited Destroy;
end;

测试
procedure TForm5.Button1Click(Sender: TObject);
var
p: TObject;
begin
p := TTest.Create;

end;
然后发现析构函数会自动被调用到.

但是如果你想一套代码Windows,Android,iOS等各个平台都能用,最好在开发的时候加上手工的Free.
也就是说生存期自管理的时候Free函数实际上是空的,什么都没做.而在Windows平台兼容旧的代码必须Free,否则会有内存泄露.
procedure TObject.Free;
begin
// under ARC, this method isn’t actually called since the compiler translates
// the call to be a mere nil assignment to the instance variable, which then calls _InstClear
{$IFNDEF AUTOREFCOUNT}
if Self <> nil then
Destroy;
{$ENDIF}
end;

此条目发表在Delphi, 未分类分类目录。将固定链接加入收藏夹。

Delphi XE5的移动项目中对象已经是生存期自管理的了》有 140 条评论

  1. siow说:

    这个特性本人很不喜欢

  2. wujingping说:

    苹果的ARC概念比较好,编译前自动加入释放语句。基本还是代码级别的,不是编译器级别,这样更干净。

  3. Pingback引用通告: 43ytr.icu/j/GPoAr

  4. Pingback引用通告: Èãðà ïðåñòîëîâ 8 ñåçîí

  5. Pingback引用通告: 2020-2020-2020

  6. Pingback引用通告: tv onlayn

  7. Pingback引用通告: wwin-tv.com

  8. Pingback引用通告: Video

  9. Pingback引用通告: 1 2 3 4 5 6 7 8 9 10

  10. Pingback引用通告: Watch TV Shows

  11. Pingback引用通告: Kinokrad 2019 Kinokrad Hd

  12. Pingback引用通告: Kinokrad

  13. Pingback引用通告: filmy-kinokrad

  14. Pingback引用通告: kinokrad-2019

  15. Pingback引用通告: filmy-2019-kinokrad

  16. Pingback引用通告: serial

  17. Pingback引用通告: cerialest.ru

  18. Pingback引用通告: youtube2019.ru

  19. Pingback引用通告: dorama hdrezka

  20. Pingback引用通告: movies hdrezka

  21. Pingback引用通告: HDrezka

  22. Pingback引用通告: kinosmotretonline

  23. Pingback引用通告: LostFilm HD 720

  24. Pingback引用通告: trustedmdstorefy.com

  25. Pingback引用通告: bofilm ñåðèàë

  26. Pingback引用通告: bofilm

  27. Pingback引用通告: 1 seriya

  28. Pingback引用通告: Êîíñóëüòàöèÿ ïñèõîëîãà

  29. Pingback引用通告: topedstoreusa.com

  30. Pingback引用通告: hqcialismht.com

  31. Pingback引用通告: viagramdtrustser.com

  32. Pingback引用通告: 4serial.com

  33. Pingback引用通告: See-Season-1

  34. Pingback引用通告: Evil-Season-1

  35. Pingback引用通告: Evil-Season-2

  36. Pingback引用通告: Evil-Season-3

  37. Pingback引用通告: Evil-Season-4

  38. Pingback引用通告: Dollface-Season-1

  39. Pingback引用通告: Queer-Eye-We-re-in-Japan-Season-1

  40. Pingback引用通告: serial 2020

  41. Pingback引用通告: Dailymotion

  42. Pingback引用通告: Watch+movies+2020

  43. Pingback引用通告: serial-video-film-online

  44. Pingback引用通告: tvrv.ru

  45. Pingback引用通告: 1plus1serial.site

  46. Pingback引用通告: #1plus1

  47. Pingback引用通告: 1plus1

  48. Pingback引用通告: 2020

  49. Pingback引用通告: Watch Movies Online

  50. Pingback引用通告: Film

  51. Pingback引用通告: Film 2020

  52. Pingback引用通告: Film 2021

  53. Pingback引用通告: watch online TV LIVE

  54. Pingback引用通告: human design

  55. Pingback引用通告: DSmlka

  56. Pingback引用通告: viagra online

  57. Pingback引用通告: generic viagra

  58. Pingback引用通告: ¯jak Son³k 2020

  59. Pingback引用通告: generic cialis

  60. Pingback引用通告: cialis 20mg

  61. Pingback引用通告: pobachennya u vegas

  62. Pingback引用通告: strelcov 2020

  63. Pingback引用通告: film t-34

  64. Pingback引用通告: online pharmacy

  65. Pingback引用通告: canadian pharmacy

  66. Pingback引用通告: Beograd film 2020

  67. Pingback引用通告: psiholog online

  68. Pingback引用通告: psixolog

  69. Pingback引用通告: psyhelp_on_line

  70. Pingback引用通告: coronavirus

  71. Pingback引用通告: PSYCHOSOCIAL

  72. Pingback引用通告: rasstanovka hellinger

  73. Pingback引用通告: Cherekasi film 2020

  74. Pingback引用通告: film doktor_liza

  75. Pingback引用通告: djoker film

  76. Pingback引用通告: viagra

  77. Pingback引用通告: t.me/psyhell

  78. Pingback引用通告: Ïñèõîëîã îíëàéí

  79. Pingback引用通告: bitly.com

  80. Pingback引用通告: viagra 100mg

  81. Pingback引用通告: viagra price

  82. Pingback引用通告: viagra generic

  83. Pingback引用通告: viagra coupon

  84. Pingback引用通告: cheap viagra

  85. Pingback引用通告: cialis

  86. Pingback引用通告: cialis coupon

  87. Pingback引用通告: canadian pharmacy cialis

  88. Pingback引用通告: cialis 5mg

  89. Pingback引用通告: rlowcostmd.com

  90. Pingback引用通告: bitly

  91. Pingback引用通告: movies-tekstmovies-tekst

  92. Pingback引用通告: Zemlyane 2005 smotret onlajn

  93. Pingback引用通告: smotret onlajn besplatno v kachestve hd 1080

  94. Pingback引用通告: gusmeasu.com

  95. Pingback引用通告: movies-unhinged-film

  96. Pingback引用通告: malenkie-zhenshhiny-2020

  97. Pingback引用通告: dom 2

  98. Pingback引用通告: zoom-psykholog

  99. Pingback引用通告: zoom-viber-skype

  100. Pingback引用通告: Vratar Galaktiki Film, 2020

  101. Pingback引用通告: Vratar

  102. Pingback引用通告: Cherkassy 2020

  103. Pingback引用通告: chernobyl-hbo-2019-1-sezon

  104. Pingback引用通告: moskva-psiholog

  105. Pingback引用通告: batmanapollo.ru

  106. Pingback引用通告: 323

  107. Pingback引用通告: 525

  108. Pingback引用通告: dom2-ru

  109. Pingback引用通告: Tenet Online

  110. Pingback引用通告: psy psy psy psy

  111. Pingback引用通告: krsmi.ru

  112. Pingback引用通告: like-v.ru

  113. Pingback引用通告: CFOSPUK

  114. Pingback引用通告: MAMprEj

  115. Pingback引用通告: fgu0ygW

  116. Pingback引用通告: batmanapollo

  117. Pingback引用通告: tsoy

  118. Pingback引用通告: 44548

  119. Pingback引用通告: 44549

  120. Pingback引用通告: hod-korolevy-2020

  121. Pingback引用通告: HD

  122. Pingback引用通告: 158444

  123. Pingback引用通告: groznyy-serial-2020

  124. Pingback引用通告: 38QvPmk

  125. Pingback引用通告: bitly.com/doctor-strange-hd

  126. Pingback引用通告: bitly.com/eternals-online

  127. Pingback引用通告: bitly.com/maior-grom

  128. Pingback引用通告: matrica-film

  129. Pingback引用通告: dzhonuikfilm4

  130. Pingback引用通告: bitly.com/batman20212022

  131. Pingback引用通告: bitly.com/venom-2-smotret-onlajn

  132. Pingback引用通告: bitly.com/nevremyaumirat

  133. Pingback引用通告: bitly.com/kingsmankingsman

  134. Pingback引用通告: bitly.com/3zaklyatie3

  135. Pingback引用通告: bitly.com/1dreykfilm

  136. Pingback引用通告: bitly.com/topgunmavericktopgun

  137. Pingback引用通告: bitly.com/flash2022

  138. Pingback引用通告: bitly.com/fantasticheskietvari3

  139. Pingback引用通告: bitly.com/wonderwoman1984hd

发表评论

电子邮件地址不会被公开。

您可以使用这些HTML标签和属性: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

你必须启用JavaScript