As far as I know - there is no easy way to do this! Others may know better.
Is this a "I want the size of object X" or You want a routine that will calculate this for a supplied object? If the former - this can be calculated by adding up fields and allowing for alignment etc. If the later - this requires something like Size of for the Object (or possibly Class) and then working out what objects are contained and doing the same for them. I tried doing this many years (5-6 in D2) ago - I gave up at the having to work out what objects were contained (What type, allocated, not destroyed, do they contain objects, etc...) For what I wanted too much effort. For working out a simple class (no contained objects or pointers to other memory like objects) SizeOf or someother similar delphi call will do this (might be on the Class can't remember). Regards Paul McKenzie Analyst Programmer SMSS Ltd. ----- Original Message ----- From: "Neven MacEwan" <[EMAIL PROTECTED]> To: "Multiple recipients of list delphi" <[EMAIL PROTECTED]> Sent: Monday, July 14, 2003 9:03 AM Subject: Re: [DUG]: size of object > Paul > > The memory allocated to contained objects, and records etc > > N > > ----- Original Message ----- > From: "Paul Mckenzie" <[EMAIL PROTECTED]> > To: "Multiple recipients of list delphi" <[EMAIL PROTECTED]> > Sent: Monday, July 14, 2003 8:37 AM > Subject: Re: [DUG]: size of object > > > > What size are you after ? > > There are various issues with getting the size of an object. > > - Are you after DataMembers > > - Are you after the memory allocated for MethodPointers > > - Does the object contain other Objects (the memory for them is 4 bytes a > > pointer) > > - Are you after the memory allocated for contained Objects > > - Are any of the resources (e.g. Records, Objects, etc) shared with other > > objects - who owns them > > > > > > Regards > > Paul McKenzie > > Analyst Programmer > > SMSS Ltd. > > > > ----- Original Message ----- > > From: "Neven MacEwan" <[EMAIL PROTECTED]> > > To: "Multiple recipients of list delphi" <[EMAIL PROTECTED]> > > Sent: Friday, July 11, 2003 7:34 AM > > Subject: [DUG]: size of object > > > > > > > Hi > > > > > > Is there any simple way to get the memory allocaed to an object > > > > > > sizeof(Object) = 4 > > > > > > TIA > > > > > > Regards Neven > > > N.K. MacEwan B.E. E&E > > > Ph 649 621 0001 > > > Fax 649 621 0400 > > > [EMAIL PROTECTED] > > > > > > > -------------------------------------------------------------------------- > > - > > > New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED] > > > Website: http://www.delphi.org.nz > > > To UnSub, send email to: [EMAIL PROTECTED] > > > with body of "unsubscribe delphi" > > > Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/ > > > > > > > > > -------------------------------------------------------------------------- > - > > New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED] > > Website: http://www.delphi.org.nz > > To UnSub, send email to: [EMAIL PROTECTED] > > with body of "unsubscribe delphi" > > Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/ > > > > > > -------------------------------------------------------------------------- - > New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED] > Website: http://www.delphi.org.nz > To UnSub, send email to: [EMAIL PROTECTED] > with body of "unsubscribe delphi" > Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/ --------------------------------------------------------------------------- New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED] Website: http://www.delphi.org.nz To UnSub, send email to: [EMAIL PROTECTED] with body of "unsubscribe delphi" Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/
