On Sun, Feb 09, 2003 at 03:42:29PM +0100, Anton Tichawa wrote: > Hi, > > > But getMem and reAllocMem allocate a number of bytes on the heap, > > wouldn't you have to free that number of bytes using freeMem(pointer, n) > > ? > > No, Free Pascal keeps track of the allocated size for a pointer created with > GetMem/ReallocMem. They need this information for heap management, so it's a > good think to use this information to save one procedure parameter, which is > a lot. If you want to determine the number of bytes to deallocate, you may do > this by using: > > Function FreeMemSize(var p:pointer;Size:Longint):Longint; > > Definition: > FreememSize > This function should release the memory pointed to by P. The argument Size is > the expected size of the memory block pointed to by P. This should be > disregarded, but can be used to check the behaviour of the program. > > I think with FreeMemSize you may corrput the heap, so be careful with it! > > Anton.
Ok thank you very muchly :) You've been a great help. > > > > > > Btw, I'm using short strings, so I think it'll be ok for now... > > > > > Read the Manual - Free Pascal Programmer's Manual, Section 4.5, "Writing > > > Your Own Memory Manager" - because that's what you're actually doing. > > > > > > HTH > > > > > > Anton Tichawa. > > > > > > > > > > > > ---------- > > > > > > "Adas Methode war, wie sich zeigen wird, Tagtr?ume in offenbar korrekte > > > Berechnungen einzuweben." > > > > > > Doris Langley Moore: Ada, Countess of Lovelace (London 1977). > > > > > > ---------- > > > > > > Anton Tichawa > > > Volkertstrasse 19 / 20 > > > A-1020 Wien > > > mobil: +43 664 52 07 907 > > > email: [EMAIL PROTECTED] > > > > > > ---------- > > > _______________________________________________ > > > fpc-pascal maillist - [EMAIL PROTECTED] > > > http://lists.freepascal.org/mailman/listinfo/fpc-pascal > > > > _______________________________________________ > > fpc-pascal maillist - [EMAIL PROTECTED] > > http://lists.freepascal.org/mailman/listinfo/fpc-pascal > > -- > > ---------- > > "Adas Methode war, wie sich zeigen wird, Tagtr?ume in offenbar korrekte > Berechnungen einzuweben." > > Doris Langley Moore: Ada, Countess of Lovelace (London 1977). > > ---------- > > Anton Tichawa > Volkertstrasse 19 / 20 > A-1020 Wien > mobil: +43 664 52 07 907 > email: [EMAIL PROTECTED] > > ---------- > _______________________________________________ > fpc-pascal maillist - [EMAIL PROTECTED] > http://lists.freepascal.org/mailman/listinfo/fpc-pascal _______________________________________________ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal