[Python-Dev] Problems with the Python Memory Manager

Fredrik Lundh fredrik at pythonware.com
Thu Nov 24 10:19:31 CET 2005


Martin v. Löwis wrote:

> One way (I think the only way) this could happen if:
> - the objects being allocated are all smaller than 256 bytes
> - when allocating new objects, the requested size was different
>    from any other size previously deallocated.
>
> So if you first allocate 1,000,000 objects of size 200, and then
> release them, and then allocate 1,000,000 objects of size 208,
> the memory is not reused.
>
> If the objects are all of same size, or all larger than 256 bytes,
> this effect does not occur.

but the allocator should be able to move empty pools between size
classes via the freepools list, right ?  or am I missing something ?

maybe what's happening here is more like

    So if you first allocate 1,000,000 objects of size 200, and then
    release most of them, and then allocate 1,000,000 objects of
    size 208, all memory might not be reused.

?

</F>





More information about the Python-Dev mailing list