Hi James,<br><br><div class="gmail_quote">On Thu, Jul 19, 2012 at 10:16 PM, Pendergrass, James A. <span dir="ltr"><<a href="mailto:James.Pendergrass@jhuapl.edu" target="_blank">James.Pendergrass@jhuapl.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello all,<br>
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:<br>
<br>
> class Foo {<br>
> public static int main(){<br>
> manager = new Manager();<br>
> fun = getLispFunction("processResults");<br>
><br>
> new Thread() {<br>
> public void run() {<br>
> LispObject res = generateSomeLisp();<br>
> fun.execute(manager, res);<br>
> }.run();<br>
> manager = null;<br>
> while(1);<br>
> }<br>
> }<br>
<br>
The lisp side looks like:<br>
<br>
> (defun processResults (manager res)<br>
> (let ((*manager* manager))<br>
> (declare (special *manager*))<br>
> (eval res)))<br>
<br>
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.<br>
<br>
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).</blockquote><div><br>
</div><div><br></div><div>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.</div>
<div><br></div><div>The latter is probably the best long term solution anyway....</div><div><br></div><div><br></div><div>Bye,</div><div><br></div><div><br></div><div>Erik.</div></div><br>