Image not release the memory in a Seaside session

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Image not release the memory in a Seaside session

Andrés Garagiola
Hi list,

I have a problem with a Seaside session memory consumption. In my system there are a seaside session that should run for a long time (many days or months), this session is running a page that have JQuery code. This JQuery reload certain parts of the website by 5 seconds intervals.

While time is progress then the vm memory is increase and it never release this memory. In two days the memory increase of 40 MB to 530 MB. I investigate the problem and found that the callbacks are adding in this code:

store: aCallback
    | key |
    key := self advanceKey.
    callbacks
        at: (aCallback convertKey: key)
        put: aCallback.
    aCallback
        setKey: key
        callbacks: callbacks.
    ^ key

But the old callbacks never are clear, then the GC never collect this objects. After a time the image have thousands callbacks that never will be collect.

Anyone knows what can by the solution?

Thanks you very much.
Regards
Andres


_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Image not release the memory in a Seaside session

mozillanerd
Andrés Garagiola <andresgaragiola <at> gmail.com> writes:

>...

It seems to me that the closure with |key| is causing the problem. It can never
be released as the callback needs access to the closure.



_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Image not release the memory in a Seaside session

Philippe Marschall
In reply to this post by Andrés Garagiola
2010/11/30 Andrés Garagiola <[hidden email]>:

> Hi list,
>
> I have a problem with a Seaside session memory consumption. In my system
> there are a seaside session that should run for a long time (many days or
> months), this session is running a page that have JQuery code. This JQuery
> reload certain parts of the website by 5 seconds intervals.
>
> While time is progress then the vm memory is increase and it never release
> this memory. In two days the memory increase of 40 MB to 530 MB. I
> investigate the problem and found that the callbacks are adding in this
> code:
>
> store: aCallback
>     | key |
>     key := self advanceKey.
>     callbacks
>         at: (aCallback convertKey: key)
>         put: aCallback.
>     aCallback
>         setKey: key
>         callbacks: callbacks.
>     ^ key
>
> But the old callbacks never are clear, then the GC never collect this
> objects. After a time the image have thousands callbacks that never will be
> collect.

Right, because it's hard/impossible to know which ones you still need
and which ones you don't. You may still links on this page that were
created with the full page rendering and you wouldn't want their
callbacks to be removed, would you? We once limited the number of
callbacks per continuation but that lead to the situation when you
have more links then clicking on the first ones wouldn't work. The
only recommendation I can give you is to do one of those:
 * do full page requests from time to time
 * do not fire off an AJAX reload every 5 seconds and use WebSockets
or Comet instead
 * make the AJAX reloads not require a session/callback, make them go
to a dedicated WARequestHandler

Anyways I created an issue [1] but I don't think we can do much about it.

 [1] http://code.google.com/p/seaside/issues/detail?id=616

Cheers
Philippe
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside