Hi..

My java desktop application runs every time the computer starts up and runs as long as computer is ON.
It monitors all the activities and interacts with database more often and will tell me some updates by looking on the internet at regular intervals etc..etc..
So what I usuallly do is creating the threads and calling the sleep method. BUt is there any way so that i can handle the memory more efficiently as my program runs 24/7. Are there any methods which will be very much useful if we want to make the program sit silently if there is no job to do . Any advice or suggestion will be helpful

Thanks in advance

Edited 3 Years Ago by harinath_2007

There may be some advantage in using java.util.Timer rather than sleep (fewer threads hanging around, easier to clean up resources between events). All you can do about memory handling is to ensure you don't keep any references to objects you no longer need. Try running a profiler to see if your memory usage is flat or increasing over time?

Yeah.. Using Timer is a good option..

Try running a profiler to see if your memory usage is flat or increasing over time?

But i dont have any idea about profiler. How to do it ?

Edited 3 Years Ago by harinath_2007

Using a profiler to check VM memory usage over time is really easy. VisualVM is the obvious choice. It's been part of the standard JDK distribution since Java 6 point something.

This article has been dead for over six months. Start a new discussion instead.