Re: Re: Memory leak (Jim Rudnicki)

Bryan Armstrong <bryan.armstrong-6tN4nzCoH/[email protected]> Thu, 27 May 2004 10:29:33 -0500
Newsgroups gmane.comp.hardware.microcontrollers.tini
Message-ID <[email protected]>
Hong Wong wrote:
> Also Chris, if you read the java docs for System.gc, you will find out 
> that it is a function that is dangerous to use in typical applications 
> because the programmer has no control over what Java  erases. This is 
> why I made sure all objects/variables has been nulled and any important 
> information was saved elsewhere before executing this piece of code.

When using System.gc() you have no control of whether GC actually 
occurs, it is just a suggestion.

Here is the javadoc for System.gc() with JDK 1.4.2:

gc

public static void gc()

     Runs the garbage collector.

     Calling the gc method suggests that the Java Virtual Machine expend 
effort toward recycling unused objects in order to make the memory they 
currently occupy available for quick reuse. When control returns from 
the method call, the Java Virtual Machine has made a best effort to 
reclaim space from all discarded objects.

     The call System.gc() is effectively equivalent to the call:

  Runtime.getRuntime().gc()


     See Also:
         Runtime.gc()




-- 
--
Bryan Armstrong
bryan.armstrong-6tN4nzCoH/[email protected]

_______________________________________________
TINI mailing list
TINI-6tN4nzCoH/[email protected]
To UNSUBSCRIBE, edit your profile, or see list archives:
http://lists.dalsemi.com/mailman/listinfo/tini