[Python-Dev] C API for gc.enable() and gc.disable()

Stephen J. Turnbull stephen at xemacs.org
Sun Jun 22 05:43:26 CEST 2008


"Martin v. Löwis" writes:
 > > XEmacs implements this strategy in a way which is claimed to give
 > > constant amortized time (ie, averaged over memory allocated).
 > 
 > See my recent proposal.

I did, crossed in the mail.  To the extent that I understand both
systems, your proposal looks like an improvement over what we've got.

 > > However, isn't the real question whether there is memory pressure or
 > > not?  If you've got an unloaded machine with 2GB of memory, even a 1GB
 > > spike might have no observable consequences.  How about a policy of
 > > GC-ing with decreasing period ("time" measured by bytes allocated or
 > > number of allocations) as the fraction of memory used increases,
 > > starting from a pretty large fraction (say 50% by default)?
 > 
 > The problem with such an approach is that it is very difficult to
 > measure.

On some systems it should be possible to get information about how
much paging is taking place, which would be an indicator of pressure.

 > What to do about virtual memory?

If you're in virtual memory, you're already in trouble.  Once you're
paging, you need to increase time between GCs, so the rule would not
be monotonic.


More information about the Python-Dev mailing list