[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [Fwd: Help with COBOL grammar for sablecc]



Some Java virtual machines (JVM), for example Sun's 1.1.8 version, do not
appear to release memory back to the operating system (OS) after garbage
collection (GC).  The GC returns memory only to its private heap.  It
releases memory back to the OS only on exit.  The consequence is that the
application will grow to and persist at its maximum virtual memory size
until that exit occurs.  Since there is no obligation under the JVM
specification to collect garbage under any particular circumstances, it is
possible that the JVM will at times find it more expedient to request more
memory from the OS that to expend the processing time necessary to do a GC.

Java 2 (Sun's 1.2 version) seems to have fixed this particular problem.  On
Windows platforms, Microsoft's jview also seems to do the right thing about
releasing memory.  Thus, trying a different JVM may help.  Which one were
you using when encountering the problem?

You can monitor GC activity by using the -verbosegc option on the java
command line.  Be warned, it is *very* verbose.

Also you could instrument SableCC (or any other application) with calls to
(Runtime methods) freeMemory() and totalMemory() to monitor memory usage at
various stages of execution.  If the trouble is some kind of bug in your
grammar or in SableCC (!) this technique might help you find it.

Finally, there may be places within SableCC where a call to synchronous GC
(Runtime method gc()) would be appropriate.  My experience in other
applications has been that an occaisional call to gc() after creating a lot
of objects that have been de-referenced does wonders.

John M. Dixon
johndixon@compaq.com
COMPAQ http://www.compaq.com



> -----Original Message-----
> From: Etienne M. Gagnon [mailto:egagnon@j-meg.com]
> Sent: Sunday, June 11, 2000 12:41 PM
> To: sablecc-list
> Subject: [Fwd: Help with COBOL grammar for sablecc]
> 
> 
> Date: Sun, 11 Jun 2000 18:42:58 +0100
> From: Dr X Liu <liu.xk@cs.cf.ac.uk>
> To: sablecc-list@sable.mcgill.ca
> Subject: Help with COBOL grammar for sablecc 
> 
> Hello All,
> 
> I came cross a problem when I use SableCC to generate COBOL parser.
> My COBOL grammar is quite big and already in SableCC format.
> 
> The problem is that every time I run "java SableCC cobol.grammar",
> it terminated with message 'OutOfMemoryError' at the step" generating
> parser".
> 
> I tried to use -mx and -ms option of java, but it doesn't work.
> And my machine has 256M memory and virtual page size is set to
> 2048M. Sometimes the running time is more than 8 hours.
<snip>