Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > VCL

Lost Password?

Thread Tools Display Modes
Old 07-26-2016, 04:30 AM
lexd lexd is offline
Senior Member
Join Date: Feb 2015
Posts: 268
Question allocating memory to a Object

in IdAntiFreezeBase.pas unit, component TIdAntiFreezeBase is laid out like any normal object.
and then Indy has
HTML Code:
  GAntiFreeze: TIdAntiFreezeBase = nil;
Var means the compiler is allocating a TIdAntiFreezeBase pointer and naming it GAntiFreeze. But create is not called so the memory is not allocated for the object's data. Am I correct?

Yet other objects simply access GAntiFreeze as if it's a running object.
as if some one said

HTML Code:
   GAntiFreeze := TIdAntiFreezeBase.Create(nil);
I would like to know the difference in code (above)
Reply With Quote
Old 07-26-2016, 12:46 PM
Norrit Norrit is offline
Join Date: Aug 2001
Location: Landgraaf
Posts: 7,333

It's called through InitComponent (GAntiFreeze := Self)

All other code is validated through ShouldUse, which returns False (among other reasons) when GAntiFreeze = nil
Code that uses GAntiFreeze is never executed when ShouldUse is True
Reply With Quote
Old 07-26-2016, 10:22 PM
lexd lexd is offline
Senior Member
Join Date: Feb 2015
Posts: 268

Indy 9 InitComponent does not exist in any Indy code

Going further back in my code TIdSocketHandle.Readable calls TIdAntiFreezeBase.ShouldUse that defaults to true and the object has no memory allocated to it effectively doing nothing to AntiFreeze a blocked Indy socket. So its not worth the space on the disk drive?
Reply With Quote


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT. The time now is 04:18 AM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2019, vBulletin Solutions, Inc.