You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Chris Simmons <cp...@decisionsoft.com> on 2007/02/05 15:00:04 UTC
XMLGrammarLoader memory leaks?
Hi,
I've been trying to track down memory leaks in our application and have
noticed that the XMLGrammarLoader internally retains hard references to
schema grammars after completing a parse. This occurs in the grammar
bucket and XSDHandler also keeps an import map, there may be other
places too. It does remove them on the next parse, but this kind of
thing tends to obscure real leaks. Discarding the parser is an option
but it isn't ideal as it seems to involve quite a performance overhead
compared with reusing the same parser.
I've also found that XSDHandler also has a field 'fParent' which appears
to be a stack of XSObject's. This is never cleared, only grown as
required, which means that an object that finds its way into here may
well never be garbage collected.
Thanks,
Chris Simmons.
---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org
Re: XMLGrammarLoader memory leaks?
Posted by Michael Glavassevich <mr...@ca.ibm.com>.
Hi Chris,
Chris Simmons <cp...@decisionsoft.com> wrote on 02/05/2007 09:00:04 AM:
> Hi,
>
> I've been trying to track down memory leaks in our application and have
> noticed that the XMLGrammarLoader internally retains hard references to
> schema grammars after completing a parse. This occurs in the grammar
> bucket and XSDHandler also keeps an import map, there may be other
> places too. It does remove them on the next parse, but this kind of
> thing tends to obscure real leaks. Discarding the parser is an option
> but it isn't ideal as it seems to involve quite a performance overhead
> compared with reusing the same parser.
There are many more instances than that and probably hundreds of
structures across the parser components which get cleared on reset or grow
(e.g. the SymbolTable) as they're used. I understand that this makes it
tough to monitor the memory usage but these aren't memory leaks [1].
> I've also found that XSDHandler also has a field 'fParent' which appears
> to be a stack of XSObject's. This is never cleared, only grown as
> required, which means that an object that finds its way into here may
> well never be garbage collected.
Yeah, we should probably be clearing that.
> Thanks,
>
> Chris Simmons.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
> For additional commands, e-mail: j-users-help@xerces.apache.org
[1] http://en.wikipedia.org/wiki/Memory_leak#Is_it_a_memory_leak.3F
Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org