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 Mark Rowell <Ma...@mutant-tech.com> on 2001/05/16 14:16:38 UTC

Memory Leaks on Solaris only

Hi

I am processing a large amount of XML data (around 80 meg) using the
Xerces-J SAXParser. The XML file I am parsing consists of references to
around 40 external entities which are themselves in separate files. 

The problem is that I seem to get memory leaks, but only on Solaris (on
NT4.0 memory of the app stays within 80Meg). On Solaris the memory after
the parse doesn't seem to be freed up. The parser is local to a method
in another class, and I deliberately set the reference to the parser to
null to encourage garbage collection (better to be safe than sorry!).

Anyway,  my real question is this: Has anyone on this list seen this
behaviour on Solaris?

Config is:

JDK 1.3.0 SE
HotSpot Server edition 2.0
Xerces-J 1.3.1
Solaris 7

Many thanks

Ma


+============================================================+
| Mark Rowell               Mutant Technology Limited        |
|                           http://www.mutant-tech.com       |
|                                                            |
|                           SecuritiesFinance.net            |
|                           http://www.secfinex.com          |
| MM   MM   TTTTTT  LLLL                                     |
| MMM MMM   T TT T   LL     CreditTrade                      |
| MMMMMMM     TT     LL     http://www.credittrade.com       |
| MM M MM     TT     LL                                      |
| MM   MM     TT     LL      t: +44 (0207) 257 9981          |
| MM   MM     TT     LL  LL  f: +44 (0207) 836 2600          |
| MM   MM    TTTT   LLLLLLL  e: mailto:markr@mutant-tech.com |
+============================================================+

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org


Re: Memory Leaks on Solaris only

Posted by Paul Jakubik <pa...@yahoo.com>.
I think this may have more to do with the Solaris
operating system than anything else. It may not be
possible or may just not be easy for a process in
Solaris to return memory to the operating system. I
vaguely remember there was something about this, but
it has been several years since I dealt with this
issue on Solaris.

One way to test this would be to parse the 80 meg of
XML data repeatedly in the same process. In between
each parse, execute a function that looks something
like the following (from Java Platform Performance:
Strategies and Tactics by Steve Wilson and Jeff
Kesselman, page 60):

  private static void gc()
  {
    try
    {
      System.gc();
      Thread.currentThread().sleep(100);
      System.runFinalization();
      Thread.currentThread().sleep(100);
      System.gc();
      Thread.currentThread().sleep(100);
      System.runFinalization();
      Thread.currentThread().sleep(100);
    }
    catch (Exception e)
    {
      e.printStackTrace();
    }
  }

After that test, if the size of the process is the
same as it was after processing the 80 meg file just
once, then there is no memory leak, there is just an
issue with returning memory to the operating system
either due to Solaris or your VM. If the size of the
process keeps growing each time you process the 80 meg
file, then there is a memory leak either in your code
or in one of the libraries you are using, and you may
need a good profiler to help you track it down.

I hope this helps, good luck.

--Paul
--- Mark Rowell <Ma...@mutant-tech.com> wrote:
> Hi
> 
> I am processing a large amount of XML data (around
> 80 meg) using the
> Xerces-J SAXParser. The XML file I am parsing
> consists of references to
> around 40 external entities which are themselves in
> separate files. 
> 
> The problem is that I seem to get memory leaks, but
> only on Solaris (on
> NT4.0 memory of the app stays within 80Meg). On
> Solaris the memory after
> the parse doesn't seem to be freed up. The parser is
> local to a method
> in another class, and I deliberately set the
> reference to the parser to
> null to encourage garbage collection (better to be
> safe than sorry!).
> 
> Anyway,  my real question is this: Has anyone on
> this list seen this
> behaviour on Solaris?
> 
> Config is:
> 
> JDK 1.3.0 SE
> HotSpot Server edition 2.0
> Xerces-J 1.3.1
> Solaris 7
> 
> Many thanks
> 
> Ma
> 
> 
>
+============================================================+
> | Mark Rowell               Mutant Technology
> Limited        |
> |                          
> http://www.mutant-tech.com       |
> |                                                   
>         |
> |                           SecuritiesFinance.net   
>         |
> |                           http://www.secfinex.com 
>         |
> | MM   MM   TTTTTT  LLLL                            
>         |
> | MMM MMM   T TT T   LL     CreditTrade             
>         |
> | MMMMMMM     TT     LL    
> http://www.credittrade.com       |
> | MM M MM     TT     LL                             
>         |
> | MM   MM     TT     LL      t: +44 (0207) 257 9981 
>         |
> | MM   MM     TT     LL  LL  f: +44 (0207) 836 2600 
>         |
> | MM   MM    TTTT   LLLLLLL  e:
> mailto:markr@mutant-tech.com |
>
+============================================================+
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> xerces-j-user-unsubscribe@xml.apache.org
> For additional commands, e-mail:
> xerces-j-user-help@xml.apache.org
> 


__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org