wood burning stoves*
The moose likes Threads and Synchronization and the fly likes trying to cut down on memory by not launching each process in its own jvm Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Threads and Synchronization
Bookmark "trying to cut down on memory by not launching each process in its own jvm" Watch "trying to cut down on memory by not launching each process in its own jvm" New topic
Author

trying to cut down on memory by not launching each process in its own jvm

jim mcnamara
Ranch Hand

Joined: Jun 13, 2007
Posts: 64
HI-

My app in the task manager is using 60k java, 50k my little application, and 22k (derby db). I am trying to use threads so that it doesn't start its own jvm. Should that help?
I don't think my application should take up 50 k.

The app runs but I haven't figured out the threads part to it.

Please assist if it is something minor I am not doing right but if it is a real mess just say so. Thanks for any assistance or advice. I will stay up a while in case someone is around. I
am going to make a quick pizza run and I will be back. I will be up for another hour or two at least GMT - 5. THANKS

Here is the code:

jim mcnamara
Ranch Hand

Joined: Jun 13, 2007
Posts: 64
HI-

I launch the app with java -jar myjar.jar com.thirdshiftcoder.derbyApp.MapDemo.

My hobby site is here my web site

That way you can see the picture of the small application.

thanks
jim mcnamara
Ranch Hand

Joined: Jun 13, 2007
Posts: 64
"Memory Requirements

The following tables list the minimum memory requirements for Windows 64-bit operating systems:

Note: The minimum physical RAM is required to run graphically based applications. More RAM is recommended for applets running within a browser using the Java Plug-in. Running with less memory may cause disk swapping, which has a severe effect on performance. Very large programs may require more RAM for adequate performance."

I am using 69k and 49k for java.exe including the apache derby db server process in those numbers. It is hard to believe, but according to this, am I not doing that badly??

I use SWT, apache derby, hibernate, java for my simple GUI application and package my start up jar with maven.

Please respond with a quick sentence like "it is okay - that sounds normal." The way I interpret it is that it goes up from the baseline of 128k or so, depending on the size of your application in Win 7. It seems so huge. I keep thinking I did something wrong. The people at work want to know if my application is taking up too much memory. I don't mind if that is normal, as I have lots of ram on my machine.

I have to catch some sleep. If my app is okay with memory use, Id like to consider continued use of java! I want to get better at hibernate.
THANKS!
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41151
    
  45
What is "each process" you mention? A copy of the above code? If so, since it seems to have a GUI, presumably there can be only so many before the user is overwhelmed? Why would the user want to run several copies, instead of a single one opening multiple windows?

The small numbers you mention are misleading - the JVM will use a whole lot more memory than that. I think something 32MB may be the default size to be allocated to a JVM on a normal desktop machine.

And since the app uses SWT, that by itself adds another whole bunch of stuff on top of what the JVM usually needs. I don't know enough about SWT to say how much is a reasonable memory allocation, though.


Ping & DNS - my free Android networking tools app
jim mcnamara
Ranch Hand

Joined: Jun 13, 2007
Posts: 64
Hi Ulf-

Thanks for writing. Each process is in the windows task manager is listed like this:

java.exe 30,000k
javaw.exe 28,744 k


I meant MB but they list in the task manager as ending in 3 extra 000 like 30,000,000 instead of writing 30 MB. It is kind of like when you read financials and you have to add whatever zeros you need, so the report makes sense. Sorry I wasn't more clear.

Java is tricky for certain things. I will go to the other forums and ask in brevity how much SWT tacks on and how much hibernate tacks on. I am going to strip the thread code out of my little GUI app because I need to experiment with threads more before trying to use it.

I am just trying to obtain a general idea, and you definitely helped. You said the JVM normally allocates 32 MB. That helps and is a good start. I am going to read a bit more before posting at Hibernate and SWT forums.

thanks!




jim mcnamara
Ranch Hand

Joined: Jun 13, 2007
Posts: 64
Hi Ulf-

I just had an idea. I ran just a simple hello world application with SWT code and no extra java code. It was 13,000 k in the task manager. I noticed its initial heap size was less than 32 mb.
I am going to run a test with hibernate and no SWT and launch that to see what the jvm does kind of like the hello world test for hibernate.

jvm threads on forum


from the link above:
"When you start multiple Java programs on your computer, each of those programs will run in a separate process, with a separate JVM (instance). "

Thanks for helping. No need to post anymore on this topic. Post closed and solved.

thanks




thanks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: trying to cut down on memory by not launching each process in its own jvm
 
Similar Threads
SWT resize/modal question
Why can't I delete item form table.(SWT)
Show values into Table
two rows get added while inserting single row
Problem creating a dynamic form with SWT