[fpc-pascal] New object created in custom pool

Florian Klaempfl florian at freepascal.org
Tue Oct 28 16:05:21 CET 2008


JoshyFun schrieb:
> Hello FPC-Pascal,
> 
> My application will create thousands of small objects of the same
> class, this objects are not created or destroyed in a row, so memory
> fragmentation could becomes a serious problem after some time.

Since the fpc heap manager itself pools, this should be a non issue.

> 
> My question is: Is there any way to override the object creation to
> use a specific memory block ? This means, I plan to get a quite big
> bunch of continuos memory block at the beginning to allocate the
> needed space for all objects of that specific class and assign slots
> "manually" and reduce the memory fragmentation.
> 
> In other words, is there any way to write something like overriding the
> create method like:
> 
> constructor MyObject.Create()
> begin
>      result:=GetMem(sizeof(myobject));
> end;
> 
> Thank you.
> 




More information about the fpc-pascal mailing list