[Python-Dev] gc ideas -- sparse memory (original) (raw)
"Martin v. Löwis" martin at v.loewis.de
Sat Dec 4 00:15:48 CET 2010
- Previous message: [Python-Dev] gc ideas -- sparse memory
- Next message: [Python-Dev] gc ideas -- dynamic profiling
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Am 03.12.2010 23:55, schrieb Dima Tisnek:
How hard or reasonable would it be to free memory pages on OS level?
Very easy. Python already does that.
[pcmiiw] Gabage collection within a generation involves moving live objects to compact the generation storage. This separates the memory region into 2 parts "live" and "cleared", the pointer to the beginning of the "cleared" part is where next allocation is going to happen.
I think you are talking about copying collectors here. This is not how Python's garbage collection works.
When this is done, does Python gc move the objects preserving order or does it try to populate garbaged slot with some live object disregarding order? Earlier case is more applicable, but latter case is a target for below too.
(C)Python's garbage collector is not moving objects at all.
If we were to look at memory regions from the OS point of view, they are allocated as pages (or possibly as hugetlb pages). So if we are to compact something like this [LL][L_][][LLL][LFFF] where []_ is a page, L is live object and is garbage and F is free memory, _would it not make more sense to tell OS that [] is not needed_ anymore, and not move some of the consequtive [LLL][LFFF] at all, or at least not move those objects as far down the memory region?
See above. Python does no moving of objects whatsoever.
Regards, Martin
- Previous message: [Python-Dev] gc ideas -- sparse memory
- Next message: [Python-Dev] gc ideas -- dynamic profiling
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]