[Openerp-community] force OpenERP / Python to release memory

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[Openerp-community] force OpenERP / Python to release memory

Ferdinand Gassauer
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     : [hidden email]
Unsubscribe : https://launchpad.net/~openerp-community
More help   : https://help.launchpad.net/ListHelp
Reply | Threaded
Open this post in threaded view
|

Re: [Openerp-community] force OpenERP / Python to release memory

Yann Papouin
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 <[hidden email]>:
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     : [hidden email]
Unsubscribe : https://launchpad.net/~openerp-community
More help   : https://help.launchpad.net/ListHelp



_______________________________________________
Mailing list: https://launchpad.net/~openerp-community
Post to     : [hidden email]
Unsubscribe : https://launchpad.net/~openerp-community
More help   : https://help.launchpad.net/ListHelp
Reply | Threaded
Open this post in threaded view
|

Re: [Openerp-community] force OpenERP / Python to release memory

Daniel Reis (SECURITAS SA)-3
Not sure if it's well supported in 6.1, bat what about using gunicorn
workers?
At least on v7 workers are regularly killed and restarted, giving you
that fresh restart effect on used memory.

/DR

_______________________________________________
Mailing list: https://launchpad.net/~openerp-community
Post to     : [hidden email]
Unsubscribe : https://launchpad.net/~openerp-community
More help   : https://help.launchpad.net/ListHelp
Reply | Threaded
Open this post in threaded view
|

Re: [Openerp-community] force OpenERP / Python to release memory

Leonardo Pistone - camptocamp
Normally the python garbage collector should be run periodically.
Still the gc module should help debugging and fine tuning if
necessary.

On the other hand, I agree with Daniel's point. Workers work on 6.1
(but the setup is a bit different from 7.0).

On Tue, Jul 1, 2014 at 3:15 PM, Daniel Reis <[hidden email]> wrote:

> Not sure if it's well supported in 6.1, bat what about using gunicorn
> workers?
> At least on v7 workers are regularly killed and restarted, giving you that
> fresh restart effect on used memory.
>
> /DR
>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~openerp-community
> Post to     : [hidden email]
> Unsubscribe : https://launchpad.net/~openerp-community
> More help   : https://help.launchpad.net/ListHelp

_______________________________________________
Mailing list: https://launchpad.net/~openerp-community
Post to     : [hidden email]
Unsubscribe : https://launchpad.net/~openerp-community
More help   : https://help.launchpad.net/ListHelp