Faster Virtual Method Dispatch
James Dunne
james.jdunne at gmail.com
Thu Apr 27 20:02:29 PDT 2006
Craig Black wrote:
>>I'm not entirely familiar with the concept of allocators as you describe.
>>Is this similar to memory pooling? I always skipped over that portion of
>>the C++ STL; way too much complexity for my small brain =P.
>
>
> Instead of calling malloc for each allocation unit, you could write an
> allocator class that would allocate memory in large chunks. Then when you
> want an allocation unit, you request it from the allocator. The allocator
> simply hands out the memory, an marks it as used.
>
> The hierarchical memory system you describe lends itself to using such
> custom allocators, because you would never have to call free for each unit.
> You could call free at the allocator level instead. In this way, you would
> only call malloc and free for large chunks of memory.
>
> You could also inform each allocator how much memory to reserve when they
> are created, since you may have a good idea of how much memory a given task
> will require.
>
> Did that help?
>
> -Craig
>
>
Yes I understand. Thank you. Very interesting concept.
I don't think in my current situation that calling malloc is a definite
bottleneck. When I see a performance concern later on, I'll definitely
look into it.
--
Regards,
James Dunne
More information about the Digitalmars-d
mailing list