[armedbear-devel] Space leak due to threads stuck in LispThread map
Erik Huelsmann
ehuels at gmail.com
Thu Jul 19 22:37:24 UTC 2012
Hi James,
On Thu, Jul 19, 2012 at 10:16 PM, Pendergrass, James A. <
James.Pendergrass at jhuapl.edu> wrote:
> Hello all,
> I'm having some trouble with space leakage that looks to be because the
> static map in LispThread isn't letting go of completed JavaThreads.
> Basically what I'm doing on the Java side looks like:
>
> > class Foo {
> > public static int main(){
> > manager = new Manager();
> > fun = getLispFunction("processResults");
> >
> > new Thread() {
> > public void run() {
> > LispObject res = generateSomeLisp();
> > fun.execute(manager, res);
> > }.run();
> > manager = null;
> > while(1);
> > }
> > }
>
> The lisp side looks like:
>
> > (defun processResults (manager res)
> > (let ((*manager* manager))
> > (declare (special *manager*))
> > (eval res)))
>
> But the manager never gets destroyed. I used the eclipse Java Memory
> Analysis tool to track this down to the created JavaThread being referenced
> as a key in the static map variable in LispThread.
>
> Any suggestions on how to get around this? The whole code base is pretty
> memory intensive so garbage collecting that manager is really a must (and
> cleaning up the thread is probably a good plan too).
One way around this would be to use the LispThread class from the
org.armedbear.lisp package: it removes the thread it creates from the map
when the thread.run() function terminates. The other option would be for
someone to rewrite the map to use a weak hash table algorithm.
The latter is probably the best long term solution anyway....
Bye,
Erik.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/armedbear-devel/attachments/20120720/06a974ca/attachment.html>
More information about the armedbear-devel
mailing list