[fpc-pascal] New object created in custom pool

Jonas Maebe jonas.maebe at elis.ugent.be
Tue Oct 28 16:58:04 CET 2008


On 28 Oct 2008, at 16:50, JoshyFun wrote:

> Hello Jonas,
>
> Tuesday, October 28, 2008, 4:24:56 PM, you wrote:
>
>>>> 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.
> JM> It depends on how small the instances are.
>
> The "problem" is that most objects are quite small, two pointers and
> two int64 values (maybe 2 pointers more in a near future), but it must
> be a class instead a record because it could be overriden and
> specialized for other minor tasks (minor in the
> amount of created objects). The big "but" is that the creation of this
> objects will be in blocks of around 100

100 bytes and smaller are most certainly handled using pools by FC's  
heap manager.

> in average and every each
> block some big objects are created and many times allocation pages
> seens to be only half filled using the calculator

The calculator and which base size? Did you call instancesize to see  
how much space is required for each instance?


Jonas



More information about the fpc-pascal mailing list