[Python-3000] Free list for small longs
"Martin v. Löwis"
martin at v.loewis.de
Thu Feb 7 00:04:01 CET 2008
Christian Heimes wrote:
> Martin v. Löwis wrote:
>> I wonder whether such a thing should run as a side effect of a full
>> garbage collection, also. GC has a chance to free up arenas for good,
>> and allocated-but-unused blocks on arenas prevent Python from returning
>> them to the OS.
>
> Under which condition does a full garbage collection take place? Does
> the interpreter run a full gc once in a while or is it started by
> gc.collect()?
Both. Let (a,b,c) equal gc.get_threshold(), then a full gc happens
after a*b*c object allocations (roughly; early object deallocations
are deducted from that number). Currently, this product is 70000.
> I'm more concerned about the int and float memory blocks. They should
> get freed when more than a couple of hundred blocks are allocated. The
> other free lists are much smaller. But memory fragmentation is an issue
> for them, too.
Ain't we talking about Python 3? There aren't any int memory blocks
around. As for float objects - sure, we should do something about them.
I propose to change them into a freelist as well, and allocate float
objects through pymalloc.
I'd be curious whether any real-world application allocates tons of
float objects temporarily, and whether such an application would improve
by using the Numeric extensions.
Regards,
Martin
More information about the Python-3000
mailing list