Neeba Rebbaca wrote:I will receive data from GPS device for 80+ vehicles to a table for every 20 secs...
None of that really tells us anything useful.
You mentioned that the memory used goes to about 500MB.
1) How are you determining that?
2) Does it get to that point and then stabilize, and things keep running fine? Or does it keep climbing until you get OutOfMemoryError?
3) What is the -Xmx startup parameter for your JVM?
Using that much memory is not necessarily a bad thing. If you allowed the JVM that much at startup, it's free to consume all of it before it does any GC. Additionally, it's not required to give any memory back to the OS when it does GC, so if you're looking at top or Task Manager, even though the
java executable may be consuming 500 MB from the OS, your program may only be using a small fraction of that.
If you keep reducing the -Xmx value until you get to the point where it does get OOME, that will give you a rough idea of how much memory your app is actually using. Or you could put a profiler on it to see what's chewing up the memory, and how much is actually being used.
Other than that, without actually seeing the code (and we don't like large wads of code being posted here), it's impossible to say what the problem is--or if there really even
is a problem at all.