Allen Bierbaum schrieb:
> The python process.  The number of objects seems to remain fairly
> controlled.  But the amount of resident memory used by the python
> process does not decrease.  I had expected that by calling
> gc.collect(2) python would reclaim any objects that could be freed and
> free all memory associated with them, thus decreasing the consumed
> memory.  Maybe this is an invalid assumption.  Do you know any way to
> ask python to shrink it's process size (ie. clear unused memory that
> has been freed but evidently not given back to the OS)?

Thats an invalid assumption for most systems with pooling allocators. Its
usually called a high-watermark allocator which assumes your process has a
steady state of memory usage. Its usually not a problem, unless your running
short of virtual address space/swap space because any decent OS will just
page out the unused memory blocks. But you may be out of luck still if the
layout of the pool prevents such e.g. if one object in every memory page is
active the system cannot swap out anything and you need a harder working GC
to readjust all references to really get completly free blocks.

In addition you need the cooperation of the OS free() call, not all systems
really give memory back, even if you free() it, some just keep it in a pool
for the process.

One typical pattern to get around this is to just fork a worker for the
memory intensive stuff and let it quit when done so the memory gets returned
to the system.

Michael

-- 
Michael Schlenker
Software Engineer

CONTACT Software GmbH           Tel.:   +49 (421) 20153-80
Wiener Straße 1-3               Fax:    +49 (421) 20153-41
28359 Bremen
http://www.contact.de/          E-Mail: m...@contact.de

Sitz der Gesellschaft: Bremen
Geschäftsführer: Karl Heinz Zachries, Ralf Holtgrefe
Eingetragen im Handelsregister des Amtsgerichts Bremen unter HRB 13215

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to