Python Memory Manager

Paul Rubin http
Sun Feb 17 13:57:08 EST 2008


Pie Squared <PieSquared at gmail.com> writes:
> Also, if it does, how does it deal with memory segmentation? This
> question bothers me because I've been trying to implement a moving
> garbage collector, and am not sure how to deal with updating all
> program pointers to objects on the heap, and thought perhaps an answer
> to this question would give me some ideas. 

As I understand it, Python primarily uses reference counting, with a
mark and sweep scheme for cycle breaking tacked on as an afterthought.
It doesn't move objects in memory during GC so you can get
fragmentation. It's probably not feasible to change this in CPython
without extensive rewriting of CPython and maybe a lot of external C
modules.

> (Also, if you know any
> resources for things like this, I'd be grateful for links/names)

If you mean about GC in general, the old book by Jones and Lins is
still standard, I think.



More information about the Python-list mailing list