• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Memory issue

 
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi to all !!! I got a serious problem. My program(using thread) is occupying exceptionally more space(573,888k). It will create more than 80+ threads and keep running.
Please help me, in managing memory. Where all the places I have to check to sort out this issue. Thanks in advance.

 
Bartender
Posts: 1558
5
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Neeba Rebbaca,

Please TellTheDetails.

The description of issue you've given is pretty vague. It creates several questions like:
1) What those threads do?
2) Is there huge number of object creation anywhere?
3) What is need to create 80+ threads?

Unless you provide some information about business logic (code would be even better), its very difficult to fix the issue.

I hope this helps.
 
Neeba Rebbaca
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I will receive data from GPS device for 80+ vehicles to a table for every 20 secs. So i will be checking, the backend for every 20secs and process the data.
I have 4 class files, Main.class, Loc1,Loc2,Loc3

Intially,ie., when the application starts up, based on the location, the vehicle(id) will be sent to three different class (Loc1,Loc2,Loc3)
Main class - This class will find the initial location of the vehicle and create a thread.

Loc1 , will get data from back end for every 20 secs and process and thread will go to sleep for 20 secs. after that, again i will call the method in Loc.class and
get the current location, based on the location, any of the 3 class wil be called(Loc1.class,Loc2.class,Loc3.class).
 
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
Ranch Hand
Posts: 443
3
Eclipse IDE C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
These are the things you need to google ...

(java command line options) Xmx Xms Xss VisualVM
jmap & hprof.

We really need more info to help , setting a lower Xss will help (if measuring true process size) as you have so many threads but may not be the problem, if you have one at all (need to know how you have measured the problem).
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic