yes but you are not following Michele's advice. If you cache a record
or a an object like a reference, you are storing in ram of copy db
(the leak). You should cache values or dictionaries. As long as those
values are not reference fields there should be no leaks.

I am not sure the term leak is appropriate here. When you cache you
store something and storage takes space, until you clear cache. The
bigger the object you cache, the more space it takes.

On Jan 3, 4:21 am, David Zejda <d...@atlas.cz> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi,
>
> nick is not reference field. To make it sure that the issue is not
> dependent on the field definition I checked it with as simple Field as
> possible:
>
> Field('trustworthiness', 'double', default=0),
>
> defined in my model and added conversion to str:
>
>     class Blah():
>         def __init__(self):
>             self.nick = str(db.person[1].trustworthiness)
>
>     p = cache.ram('blahblah',Blah,time_expire=30)
>
> Also,
>
> def blah_f():
>      return Blah()
>
> makes no change, leads to the same leak.
>
> The leak appears regardless to the place of the declaration of Blah
> class. I tried to declare it in top level of model, in controller, and
> inside function of controller, no difference.
>
> It is possible that this IMO weird behaviour is related to another issue
> which teased me months ago:
>
> http://www.mail-archive.com/web2py@googlegroups.com/msg34333.html
>
> With regards,
> David
>
>
>
> mdipierro wrote:
> > It depends on whether nick is a reference field.
>
> > On Jan 2, 5:31 pm, Michele Comitini <michele.comit...@gmail.com>
> > wrote:
> >> what if you do this?
>
> >> class Blah():
> >>     def __init__(self):
> >>         self.nick = db.person[1].nick
>
> >> def blah_f():
> >>     return Blah()
>
> >>  p = cache.ram('blahblah', blah_f,time_expire=30)
>
> >> 2011/1/2 David Zejda <d...@atlas.cz>:
>
> - --
> David Zejda, Open-IT cz
> web development & serviceshttp://www.o-it.info
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.9 (GNU/Linux)
> Comment: Using GnuPG with Mozilla -http://enigmail.mozdev.org
>
> iEYEARECAAYFAk0hoyEACgkQ3oCkkciamVGE0gCfROfrJo7SaeDxIbPco58LHzt9
> mesAoK9JfcQKnGyAlkKfoeqIGKLJ812Z
> =IBqT
> -----END PGP SIGNATURE-----

Reply via email to