Results 1 to 13 of 13
Thread: Questions about java JVM
- 02-08-2011, 02:08 AM #1
Member
- Join Date
- Sep 2010
- Posts
- 47
- Rep Power
- 0
Questions about java JVM
Hello everyone. I have some questions about the JVM in Java. Is there any way to permanently increase it without having to run my code from the command prompt every time? If so, how? And this may be dumb but could I allot free hard drive space to the JVM (sort of like Paging in Windows)? Thanks.
- 02-08-2011, 02:15 AM #2
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Permanently increase what? I didn't get you.
-
- 02-08-2011, 02:38 AM #4
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Hmmm, better to mention those stuff clearly next time.
Anyway, you can change the shell script. For example,
where Xms<size> is the initial heap size and Xmx<size> is the maximum heap size.java -Xms64m -Xmx512m
- 02-08-2011, 02:42 AM #5
Member
- Join Date
- Sep 2010
- Posts
- 47
- Rep Power
- 0
Sorry, I meant the memory. And that code is what I meant by launching from command prompt. Or will that permanently change the heap space? I typed something like that with the name of my program (to run it).
- 02-08-2011, 02:45 AM #6
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
And at the same time, there can be maximum heap size which you can allocate for a single process. Solaris can allocate 2GB without a problem but I'm not sure with MS Windows. As far as I remember Win 2003 can allocate 1.5GB but not with XP.
In general set the maximum heap is to 1/4 of the total physical memory at the start, and generally you can increase. Set the minimum as 1/2 of the initial maximum heap, and don't change it later.
- 02-08-2011, 02:46 AM #7
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
- 02-08-2011, 02:52 AM #8
You could make a 'launcher' class that launches a new jvm instance with the correct flags. For instance, class Launcher might have a main method that executes a native command, in this case something like "java -Xmx1024m MyApp". MyApp would also have a main method. The launcher terminates as soon as it launches the second app. Some of the old IDEs were launched in this way.
- 02-08-2011, 02:56 AM #9
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
I doubt that what OP really looking for.
- 02-08-2011, 03:42 PM #10
You may be correct, I interpreted the statement
to mean 'Is there a way I don't have to type the memory arguments in every time from the command line'. A launcher would be one way to do that.Is there any way to permanently increase it without having to run my code from the command prompt every time?
- 02-09-2011, 12:29 PM #11
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
- 02-09-2011, 02:01 PM #12
Agreed! Maybe OP can clarify? Please? :D
- 02-15-2011, 12:31 AM #13
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Still no comments from our thread starter. ;)
Similar Threads
-
Some Java questions
By vegetable69 in forum New To JavaReplies: 1Last Post: 11-29-2010, 12:47 PM -
JAVA questions
By melody in forum New To JavaReplies: 0Last Post: 10-28-2009, 11:07 PM -
Pls i need help with these 2 Java Questions
By jyde in forum Advanced JavaReplies: 2Last Post: 10-19-2008, 07:33 PM -
Few Questions about java
By Grom in forum NetBeansReplies: 11Last Post: 09-13-2008, 02:26 PM -
few java questions
By hiaslpix in forum New To JavaReplies: 4Last Post: 01-01-2008, 05:47 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks