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

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 ?

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.