Hi,

I can finally point the specific part of my code where memory leaks:

    from gluon.tools import *
    w2p_recaptcha_xml = Recaptcha.xml
    def x_recaptcha_xml(self): return 'my own recaptcha xml'
    Recaptcha.xml = x_recaptcha_xml

The above replaces Recaptcha's xml method wih my own.

I know that in this specific case I can subclass Recaptcha and 
extend/override the xml method, but let's not discuss this for now.

By doing it this way (direct replacement, instead of extend/override via 
subclass), everything works ok, except when I enable the yellow line 
(w2p_recaptcha_xml 
= Recaptcha.xml above).

As soon as I enable this specific line (in yellow above) and restart uwsgi, 
memory just leaks after every single web request (much more noticeable when 
the models are very large in code), until the server stops responding due to 
very large memory consumption (after relatively few web requests).

My question is why?, is it because w2p_recaptcha_xml retains the 'context' 
of everything and it just keeps adding and adding?, or how/why exactly does 
the above cause the memory leak?.

I just want to understand the reasons.

Thanks!,

   Carlos

Reply via email to