Memory "leak"?



I'm doing a while true loop that never sets the boolean to false (ie I want
this program to run endlessly).

I've noticed after my thread sleeps for 30 seconds and wakes back up to
continue, the memory used by the system goes up by 4K.

Obviosly over days and weeks this will all mount up, so I really need to
understand about how to deal with garbage collection.

I null all my variables at the end of each loop and have created the
variables as private outside of the method I'm calling them in, in the main
class, but still the problem persists.

The code is rather long so I'd rather not post it in its entirety and have
to explain it all, but essentially the code goes:

while (true) {

checkThis();
thenCheckThis();
thenCheckThis();
Thread.sleep(30000);

}

all checkThis() does is:
{
go to a folder;
loops through folder;
anything with a certain file extension gets sent to another method;
}

That method just moves it the file from one place to another, deleting the
file from the original folder then thats it.

Why always 4K? Is this because java has a memory leak when running a loop,
or is it my code?

TIA for any pointers where to start looking!


.



Relevant Pages

  • Re: Windows Service with Timer Question
    ... When I first started writing .Net services on VS 2003 using the Framework 1.1, a guy I worked for questioned me about why I was using a While True loop. ... When I am writing a .NET Service or Console application, then I am going to spawn a child thread using a delegate with a While True loop, as the worker thread or threads. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: reading a key during the execution of a script
    ... MS has some posting that beginners progamming starts with a loop. ... Actually windows programming starts with event handling. ... Not even DOS was true loop based. ... An eighty year old nowadays enthusiases DOS. ...
    (microsoft.public.scripting.wsh)
  • GUI handles
    ... would set a attribute "value" to 0 and enters a while true loop. ... the "stop" button's callback is to set ... that once the handles is passed into a matlab script and into the ...
    (comp.soft-sys.matlab)
  • Re: Checking a folder again after it has been emptied
    ... that while loop. ... allowing additional files in that folder to be moved and now with your ... #sleep timer and number of files ... closedir PRV_SRC_1; ...
    (perl.beginners)
  • Re: Outlook 2003 vba macro
    ... Don't move or delete items in a For Each loop! ... 'Move the email Item to the backup folder ... Microsoft Outlook Programming - Jumpstart for Administrators, Power Users, and Developers ... > Dim objApp As Application ...
    (microsoft.public.outlook.program_vba)