Re: Re: Memory leak (Jim Rudnicki)

Bryan Armstrong <bryan.armstrong-6tN4nzCoH/[email protected]> Thu, 27 May 2004 08:14:25 -0500
Newsgroups gmane.comp.hardware.microcontrollers.tini
Message-ID <[email protected]>
Hong Wong wrote:
> I also have had problems with the memory leaks, mainly because I am
> performing socket communications (which are known to have memory leaks when
> leaving socket communication open).

Correct, if the application does not close a socket, the resources will 
not be freed.

> Now for my solution for memory leaks.  I perform a system garbage collect at
> subsequent iterations of my main program (i.e., System.gc() command is
> used).  It does solve my problem with memory leaks however, this manual
> garbage collection scheme is quite dangerous since it wipes out large
> amounts of memory used by the program (even the variables/objects you don't
> want to erase).

Hong, your bug report left out a few critical pieces of information:
1. What is the firmware version?
2. What is the hardware configuration (custom board, TINIm400, etc)?
3. What is the smallest snippet of code that produces this error?

> Prior to using System.gc, I have tried to null all unused
> objects from my program.  However, this did not plug the leak (so to speak).

Correct, setting references to null does not cause the previously 
referenced object to be collected.  When the GC is run, it searches all 
references and marks all found objects, then frees (sweeps) those that 
were not found in the search.


-- 
--
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