![](https://secure.gravatar.com/avatar/3acb8bae5a2b5a28f6fe522a4ea9b873.jpg?s=120&d=mm&r=g)
9 Feb
2008
9 Feb
'08
3:51 p.m.
Well, yes, it doesn't run out of memory, but if pymalloc needs to allocate lots of objects of the same size, then performance degrades due to the management overhead involved for checking the free pools as well as creating new arenas as needed.
To reduce this overhead, it may be a good idea to preallocate pools for common sizes and make sure they don't drop under a certain threshold.
I still can't see why this could speed up anything. The total time will be the same - whether you allocate them in advance or on demand should make no difference. In any case, if you think that you can improve things, please submit a patch. Regards, Martin