:: Re: [DNG] Memory management strateg…
Page principale
Supprimer ce message
Répondre à ce message
Auteur: KatolaZ
Date:  
À: Didier Kryn
CC: dng
Sujet: Re: [DNG] Memory management strategies.
On Mon, Feb 01, 2016 at 05:36:38PM +0100, Didier Kryn wrote:

[cut]

>
>     Note that if you manage your memory pool as an array then
> allocation and deallocation are extremely fast and can be done
> without consuming a single byte for book-keeping. I think this
> almost trivial allocator actually fits with many cases. It can even
> make sense to loose part of the memory if objects haven't all the
> same size, provided this size is bounded.

>


If you know in advance the typical sizes of chunks to be allocated,
then reserving different sections of your array to chunks of different
sizes can be quite efficient, and helps limiting external
fragmenttion. This was more or less the strategy actually implemented
in the original slab allocator of the Linux kernel, and might work
decently.

My2Cents

KatolaZ

--
[ Enzo Nicosia aka KatolaZ --- GLUG Catania -- Freaknet Medialab ]
[ me [at] katolaz.homeunix.net -- http://katolaz.homeunix.net -- ]
[ GNU/Linux User:#325780/ICQ UIN: #258332181/GPG key ID 0B5F062F ]
[ Fingerprint: 8E59 D6AA 445E FDB4 A153 3D5A 5F20 B3AE 0B5F 062F ]