← Back to team overview

openerp-community team mailing list archive

Re: force OpenERP / Python to release memory

 

This is an interesting point, and I did the test.

Making some searches leads me to:
http://stackoverflow.com/questions/1316767/how-can-i-explicitly-free-memory-in-python

Memory can be cleaned manually by calling garbage collector.
>>> import gc
>>> gc.collect()

Maybe this could be called by a cron task ?



2014-07-01 13:35 GMT+02:00 Ferdinand Gassauer <office@xxxxxxxxxx>:

>  Hello!
>
> Having installed an instance (still openerp 6.1) on a auto-scale cloud
> server I am interested to reduce memory usage (night, weekends...) for
> which I get charged.
>
> A possible answer I found here:
>
> http://effbot.org/pyfaq/why-doesnt-python-release-the-memory-when-i-delete-a-large-object.htm
>
> If the quote:
> *“For speed”, Python maintains an internal free list for integer objects.
> Unfortunately, that free list is both immortal and unbounded in size.
> floats also use an immortal & unbounded free list.*
> is true - memory will never decrease, as openerp/odoo heavily uses lists
> to store huge number of ids (account_move_lines, stock_moves, ...).
>
> Obviously a restart of the server will solve the problem, but I would be
> interested if other solutions exist.
>
> --
> Ferdinand Gassauer
> Eigentümer
> ChriCar Bet. u. Ber. GmbH
>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~openerp-community
> Post to     : openerp-community@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~openerp-community
> More help   : https://help.launchpad.net/ListHelp
>
>

Follow ups

References