

![]() | Start a set with this search |
![]() | Include this search in one of my sets |
![]() | Exclude this search from one of my sets |
![]() | Permalink to these results Paste this link in email or IM: |
| Atom feed for tracking future search results Paste this URL into your reader: |
34 messages in org.codehaus.groovy.devRe: [groovy-dev] Re: [groovy-user] Me...| From | Sent On | Attachments |
|---|---|---|
| Alex Tkachman | Oct 16, 2008 2:30 pm | |
| Alex Tkachman | Oct 16, 2008 3:17 pm | |
| Jochen Theodorou | Oct 16, 2008 3:49 pm | |
| Tim Quinn | Oct 16, 2008 4:15 pm | |
| Alexander Veit | Oct 16, 2008 4:34 pm | |
| Jochen Theodorou | Oct 16, 2008 4:43 pm | |
| Tim Quinn | Oct 16, 2008 5:28 pm | |
| Jochen Theodorou | Oct 17, 2008 6:35 am | |
| Alex Tkachman | Oct 17, 2008 6:44 am | |
| Graeme Rocher | Oct 17, 2008 6:54 am | |
| Jochen Theodorou | Oct 17, 2008 7:05 am | |
| Graeme Rocher | Oct 17, 2008 7:14 am | |
| alex...@gmail.com | Oct 17, 2008 7:30 am | |
| Jochen Theodorou | Oct 17, 2008 7:36 am | |
| Alex Tkachman | Oct 17, 2008 9:51 am | |
| Jochen Theodorou | Oct 22, 2008 5:27 am | |
| Alex Tkachman | Oct 22, 2008 5:37 am | |
| Jochen Theodorou | Oct 22, 2008 6:05 am | |
| Alex Tkachman | Oct 22, 2008 6:08 am | |
| Jochen Theodorou | Oct 22, 2008 6:18 am | .zip |
| Alex Tkachman | Oct 22, 2008 6:32 am | |
| Jochen Theodorou | Oct 22, 2008 7:06 am | |
| Guillaume Laforge | Oct 22, 2008 7:08 am | |
| Alex Tkachman | Oct 22, 2008 7:11 am | |
| Guillaume Laforge | Oct 22, 2008 7:21 am | |
| Jochen Theodorou | Oct 22, 2008 7:22 am | |
| Jochen Theodorou | Oct 22, 2008 7:39 am | |
| Jochen Theodorou | Oct 22, 2008 7:41 am | |
| Alex Tkachman | Oct 22, 2008 9:16 am | |
| Jochen Theodorou | Oct 22, 2008 10:11 am | |
| Jochen Theodorou | Oct 22, 2008 11:24 am | |
| Alex Tkachman | Oct 22, 2008 11:48 am | |
| Jochen Theodorou | Oct 22, 2008 2:07 pm | |
| Jochen Theodorou | Dec 22, 2008 12:52 pm |

![]() | Permalink for this message Paste this link in email or IM: |
![]() | Permalink for this thread Paste this link in email or IM: |
| Atom feed for this thread Paste this URL into your reader: |
| Subject: | Re: [groovy-dev] Re: [groovy-user] Memory leaks in Groovy | Actions... |
|---|---|---|
| From: | Jochen Theodorou (blac...@gmx.org) | |
| Date: | Oct 16, 2008 4:43:33 pm | |
| List: | org.codehaus.groovy.dev | |
Tim Quinn schrieb:
Jochen Theodorou wrote:
Alex Tkachman schrieb:
I redirect this thread to dev list because we have important issue here.
Groovy runtime starts demon-thead, which is very important reference handler for many internal data structures. See org.codehaus.groovy.util.FinalizableRef
Here is important part of the code [...] Thread thread = new Thread() { public void run() { while (true) { try { final FinalizableRef ref = (FinalizableRef) remove(); ref.finalizeRef(); } catch (Throwable t) {// } } } }; thread.setDaemon(true); thread.setName(FinalizableRef.class.getName()); thread.start();
I guess that means that the web application loader can not thrown away unless the deamon here stops, because the thread class itself is loaded by that loader.
Maybe I misunderstand what you mean. The bootstrap class loader will load java.lang.Thread.
yes, but
Thread thread = new Thread() { public void run() { while (true) { try { final FinalizableRef ref = (FinalizableRef) remove(); ref.finalizeRef(); } catch (Throwable t) {// } } } }; thread.setDaemon(true); thread.setName(FinalizableRef.class.getName()); thread.start();
is not Thread, it is a annonymous inner class
What I saw as I did the memory analysis on this is that the thread's contextClassLoader is the WebappClassLoader, and that is because the thread which creates this one has the WebappClassLoader for its contextClassLoader and the new thread takes its creator's ccl.
yes, that we need to change too... in fact that is a very fast change, as any we can simply set the bootloader as context loader for this thread.. but can the class be collected if there is a deamon still running with a class that is loaded by that thread? If I test:
def script = """ def thread = new Thread ({ sleep(Integer.MAX_VALUE) }) thread.daemon = true thread.start() """ def registry = GroovySystem.metaClassRegistry 100000.times { def shell = new GroovyShell(this.class.classLoader) shell.evaluate script if (it%100==0) { println "#"*80 println "constant meta classes: ${registry.constantMetaClassCount}" println "weak meta classes: ${registry.weakMetaClasses.size()}" } }
then be it deamon or not I will get a OOME, because the Runable given to the Thread can not be collected. It is the same with the FinalizableRef thread
Perhaps the logic you described would work for discriminating among the various profiles; I'm nowhere near familiar enough with Groovy to have an opinion about that. But is it reasonable to provide a public API which an application or a container could invoke to close down Groovy in an orderly manner which would include running down this thread?
Well, was never needed before... so there is not yet such an API... also it should be possible to use Groovy as library and normally you don't clean up behind a library. So at last there should be something that solves the problem automatically.
Granted, the developer of a web app deployed to an app server would need to have a ServletContextListener which detects when the web app is stopping and could then invoke the Groovy close-down method. That does not seem to be too much of a burden, considering the complexity of having Groovy deciding itself which profile is in effect. Just a thought.
not a big burden, but not a clean solution too. Maybe we will do both. I only suggested something, let us see what the other developers think.
bye blackdrag
-- Jochen "blackdrag" Theodorou The Groovy Project Tech Lead (http://groovy.codehaus.org) http://blackdragsview.blogspot.com/ http://www.g2one.com/
--------------------------------------------------------------------- To unsubscribe from this list, please visit:








.zip