Setting JVM stack size
Hi,
I have a Java Application that is packed in a jar file, and that I start double clicking the jar file in the Windows desktop. My question is: How can I say to the JVM that runs with a Stack Size greater of usual, I want 2MB?.
Thanks in advance!!
Salvador Huertas.
You cannot alter the stack of the primordial thread that is started with the java command (the thread is already started before the size is read.) You can alter the stack size of subsequent threads that are started - the non-primordial threads.
See http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4362291
So, you can't change the "JMV stack size" - you can change the size of additional threads.
Similar Messages
-
How to set the stack size for alchemy application?
Anybody know how to set the stack size for alchemy application?
If you know, please tell me how to adjust the stack size for alchemy application?Hi,
The stack size is set as public const gstackSize in the alchemy generated code. You can see this if you build with ACHACKS_TMPS set. The default is one megabyte.
One way to change the stack size is to use llvm-dis to disassemble avm2-libc/lib/avm2-libc.l.bc, generating avm2-libc.l.ll, modify the constant, and then use llvm-as to recompile your modified library and overwrite the old one. These utilities should be in your path if alchemy is set up. -
Can I set JVM memory size when running applets?
Hi,
I have downloaded an applet that renders panoramic images and
I have a problem with Java memory. I remember that default maximum
size that applet can use is 70MB, and the problem is 70MB is
not enough when rendering big images. It is OK when I add
"-Xmx -Xms" parameters in the Java Control but I cannot tell
everyone who wants to see my images to go control panel, add
parameters etc..
So my question is...
Is it possible add "-Xmx -Xms" parameters inside the applet file
so that these parameters run automatically when executing applet?
Thanks in advance for your reply!
HyungHi,
I have downloaded an applet that renders panoramic
images and
I have a problem with Java memory. I remember that
default maximum
size that applet can use is 70MB, and the problem is
70MB is
not enough when rendering big images. It is OK when I
add
"-Xmx -Xms" parameters in the Java Control but I
cannot tell
everyone who wants to see my images to go control
panel, add
parameters etc..
So my question is...
Is it possible add "-Xmx -Xms" parameters inside the
applet file
so that these parameters run automatically when
executing applet?
Thanks in advance for your reply!
HyungA potential workaround I would try is is use ByteBuffers
(T) -
Default stack size vs. -Xss option
Hi,
What the default stack size?
That is, if you use the -Xss<size> option, it will set the stack
size to <size>, but what is the default. I've searched and only
found one posting that says it is 256k.
http://forum.java.sun.com/thread.jsp?forum=256&thread=40530
Is that correct? Since this is a JVM option, is it platform
dependant? In that case, what would it be on Win2k and Solaris?
We are serializing graph objects and getting a StackOverflowError
on occassion. There is a well known bug about this:
http://developer.java.sun.com/developer/bugParade/bugs/4152790.html
Thanks.
--- PatrickHi,
It depends on version and OS.
In Solaris there is in addition the OS restriction in ulimit
or maxssiz in HP.
hurricane% ulimit -a
time(seconds) unlimited
file(blocks) unlimited
data(kbytes) unlimited
stack(kbytes) 8192
coredump(blocks) unlimited
nofiles(descriptors) 4096
vmemory(kbytes) unlimited
Workaround - Use "ulimit -s 2048" in bash shell or "limit stacksize 2048" in tcsh to limit the initial thread stack to 2 MB.
http://java.sun.com/docs/hotspot/VMOptions.html
Check the link for the Solaris defaults. -
-Xss: Stack size too large
There is a requirement of high stack size in the application but when I try to set the stack size > 128m , I get the below error
[ERROR] Argument error: -Xss130m
[ERROR] -Xss: Stack size too large
Could not create the Java virtual machine.
Is there a upper limit of 128m on stack size. The Jrockit version is 64 bit.
Please helpHi,
Are you running OS in 32 bit or 64 bit.
eg:
O/S 32-bit Default 64-bit Default
Windows 64 kB 320 kB
Linux 128 kB 1 mB
Please check your stack size you mentioned it is 128m please change to KB it will work.
Regards,
Kal -
JVM 1.4 default stack size
Hi,
I would like to know what is the default stack size of JVM of jdk 1.4.
Is there any command which i can use to find the current stack size set up?
Is the heap size & stack size same?
Actually i'm getting a java.lang.StackOverflowError when i execute a class ProgramCallDocument which is present in the jt400.jar provided by IBM in thier Websphere Application Studio Server suite.
The class is working fine with jdk 1.3. But it is giving an error in jdk 1.4
Do any one have any clue about this? Please Help.
Thanks,
Jac.Thanks for the reply...
Actaully I was looking for how to know the current stack size set for JVM. I assume that using -Xss command will increase the stack size, but before doing so I need to take the current stack size.
Please let me know if you know the command for getting the current stack size set for JVM.
Thanks,
Jacob. -
Upto how much I can set maximum Heap size for jvm?
I am running application on 8GB RAM Windows 64 bits machine.
I am running out of OutOfMemory (Heap Space). I want to increase the Heap Size for my jvm.
But can anybody please tell me what is the limit by which I can set the maximum size for heap?
Thanks in Advance,
JenishMax allowed memory per process is 2 raised to the 64th power. What maximum memory you can set depends on the memory available
for your application. You may be able to set more than 8GB ram then it will use the swap space and it will slow down your application
performance. So try different memory size and see which one works best for your application. -
How to set the heap size of JVM
please let me know that how to set the heap size of JVM
C:\>java -X
-Xmixed mixed mode execution (default)
-Xint interpreted mode execution only
-Xbootclasspath:<directories and zip/jar files separated by ;>
set search path for bootstrap classes and resources
-Xbootclasspath/a:<directories and zip/jar files separated by ;>
append to end of bootstrap class path
-Xbootclasspath/p:<directories and zip/jar files separated by ;>
prepend in front of bootstrap class path
-Xnoclassgc disable class garbage collection
-Xincgc enable incremental garbage collection
-Xbatch disable background compilation
-Xms<size> set initial Java heap size
-Xmx<size> set maximum Java heap size
-Xss<size> set java thread stack size
-Xprof output cpu profiling data
-Xrunhprof[:help]|[:<option>=<value>, ...]
perform JVMPI heap, cpu, or monitor profiling
-Xdebug enable remote debugging
-Xfuture enable strictest checks, anticipating future default
-Xrs reduce use of OS signals by Java/VM (see documentation)look at the -Xm? lines
-Xms<size> set initial Java heap size
-Xmx<size> set maximum Java heap sizeThis can be used e.g. like this:java -Xms8M -Xmx32M MyProgwhich runs MyProg in a java VM with the initial heap size of 8 MB and a maximum heap size of 32 MB.
- Marcus -
Stack size for native thread attaching to JVM
All:
I have a native thread (see below, FailoverCallbackThread) that attaches to the JVM and does a Java call through JNI. The stack size for the native thread is 256KB.
at psiUserStackBangNow+112()@0x20000000007a96d0
at psiGuessUserStackBounds+320()@0x20000000007a8940
at psiGuessStackBounds+48()@0x20000000007a8f60
at psiGetPlatformStackInfo+336()@0x20000000007a9110
at psiGetStackInfo+160()@0x20000000007a8b40
at psSetupStackInfo+48()@0x20000000007a5e00
at vmtiAttachToVMThread+208()@0x20000000007c88b0
at tsAttachCurrentThread+896()@0x20000000007ca500
at attachThread+304()@0x2000000000751940
at genericACFConnectionCallback+400(JdbcOdbc.c:4624)@0x104b1bc10
at FailoverCallbackThread+512(vocctx.cpp:688)@0x104b8ddc0
at start_thread+352()@0x20000000001457f0
at __clone2+208()@0x200000000030b9f0
This causes stack overflow in Oracle JRockit JVM. (It does not cause overflow with Oracle Sun JDK.) Is there a recommended stack size for this use case for JRockit? Is there a way to compute it roughly?
Platform Itanium 64 (linux)]
java version "1.5.0_06"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
BEA JRockit(R) (build R26.4.0-63-63688-1.5.0_06-20060626-2259-linux-ia64, )
mpHow do I found default heap size, stack size for the
thread, number of threads per jvm/process supported ?The threads is OS, OS install and jvm version specific. That information is also not useful. If you create the maximum number of threads that your application can create you will run out of memory. Threads require memory. And it is unlikely to run very well either.
The default heap size and stack size are documented in the javadocs that explain the tools that come with the sun jdk.
and how the above things will vary for each OS and how
do I found ? Threads vary by OS, and OS install. The others do not (at least not with the sun jvm.)
If I get "OutOfMemoryError: Unable to create new native thread" Most of the time it indicates a design problem in your code. At the very lease, you should consider using a thread pool instead.
I found in one forum, in linux you can create maximum
of 894 threads. Is it true ?Seems high since in linux each thread is a new process, but it could be. -
hi guys
i am using this command line argument to increase my jvm. it must be done on the command line as i am going to create a bat file for my users to set up their environment.
java -Xmx256m -Xms128mi not sure if its working as it just lists all the java options (the ones you get when you type 'java' and press return) when i hit return.
does this mean its working? im expecting a more definitive message.
thankshm... this is interesting.. so if i am able to get
this file in my applet and update the appropriate
line, it should update the jvm heap size? the lineid
update is :
deployment.javapi.jre.1.5.0_06.args=-Xmx164mSince the applet already runs, the heap size will not
change.
It will change for the next applet run, after closing
the browser.
Note that I did not try all this, so it is up to you
to experiment.
My idea was not to change the file from the applet.
You said 'I cannot ask all the users to change the
heap size
in the Java control panel'. I just offered you an
alternative to
this: write a program that changes the file and find
a way
to make them run this program.ok thanks for the suggestion..
i think i may have a link on the homepage which opens an applet that sets this file.. and then instruct them to restart the browser. it would be nice to keep it all within the browser instead of having them click an exe..
ill let you know if it works.
thanks again so much. -
Does Solaris10 for x86 allow me to set java jvm heap size up to 3G
Does Solaris10 for x86 allow me to set java jvm heap size up to 3G,is it really true solaris only take 512M memory address space?I can only set 2668M(2.5G)on linux cause linux kernel take 1G memory address space.Thanks~~
[url http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Runtime.html]Runtime seems to have some useful methods...
-
There seems to be general confusion around the actual behaviour of the -Xss option.
I need to optimise the thread stack size on Windows 2000 server running JVM 1.4.2 (07).
1. What is the actual minimum stack size for this JVM ? 1k, 6k, 64k ?
2. Do there exist any mechanism to measure the maximum value actually utilized by a particular application ?
The goal is simply to allocate the appropriate amount of stack space instead of guessing a safe value.The default stack size is 256K on UNIX and on 32-bit Windows operating systems. To set Stack size
java -XX:NewSize=128m -XX:MaxNewSize=128m -XX:SurvivorRatio=8 -Xms512m -Xmx512m
1. Setting the New generation heap size
-XX:NewSize
Use this option to set the New generation Java heap size. Set this value to a multiple of 1024 that is greater than 1MB. As a general rule, set -XX:NewSize to be one-fourth the size of the maximum heap size. Increase the value of this option for larger numbers of short-lived objects.
Be sure to increase the New generation as you increase the number of processors. Memory allocation can be parallel, but garbage collection is not parallel.
2. Setting the maximum New generation heap size
-XX:MaxNewSize
Use this option to set the maximum New generation Java heap size. Set this value to a multiple of 1024 that is greater than 1MB.
3. Setting New heap size ratios
-XX:SurvivorRatio
The New generation area is divided into three sub-areas: Eden, and two survivor spaces that are equal in size.
Use the -XX:SurvivorRatio=X option to configure the ratio of the Eden/survivor space size. Try setting this value to 8, and then monitor your garbage collection.
4. Setting minimum heap size
-Xms
Use this option to set the minimum size of the memory allocation pool. Set this value to a multiple of 1024 that is greater than 1MB. As a general rule, set minimum heap size (-Xms) equal to the maximum heap size (-Xmx) to minimize garbage collections.
5. Setting maximum heap size
-Xmx
Use this option to set the maximum Java heap size. Set this value to a multiple of 1024 that is greater than 1MB.
Hope these are the options you are looking for. -
Cannot increase the stack size
Hi,
We have a program which gives a StackOverflowError. Trying the increase the stack size using command line options does not work. A simple program shows that the stack is the same size, whatever option we set.
This is the program:
class StackOverflowTest
public static int counter = 0;
public static void main(String[] a)
try {
sub();
} catch (StackOverflowError e)
System.out.println("recursive calls: "+counter);
public static void sub()
counter++;
sub();
We tried several -Xss (and -Xoss) settings: 600K, 2048K, 4M but got the same recursion deep: 16683 (with Eclipse), or 16689 (command line).
We used Windows XP.
Do you have any clue?
Many thanks,
ZsoltOh good, they seem to have broken the forum formatting again.
====================================================================================================================
Bug ID: 4362291 Stack size argument ignored (-Xss and -ss)
====================================================================================================================
public class StackOverflowTest {
public static int counter = 0;
public static final void main(String[] a) {
new Thread(new Runnable() {
public void run() {
try {
sub();
} catch (StackOverflowError e) {
System.out.println("recursive calls: "+counter);
}).start();
public static final void sub() {
counter++;
sub();
/code] -
Change the default stack size in the java.exe file
Does anyone know how to change the default stack size of the jvm?
I'm having problems with my stack. Is there anyway I can change it. I found a tool editbin.exe which is shipped with Visual c++, however I don't have the tool.
Thanks,
WilliamI am using JNI to connect java with a C++ application.
When calling the C++ appliction, STACK_OVERFLOW
happends. I tried java -Xss<size> to increase the
stack size, but failed.This has nothing to do with the above question.
Does anyone knows why?Probably because the java parameter specifies the java stack size and not the C++ stack size. -
Set BorderPane components size
I want to set the size of the Center, Top, Left, Right and Bottom components of a BorderPane.
http://i.stack.imgur.com/hY8i6.png
So far I found this:
BorderPane() mainpane = new BorderPane();
mainPane.getBottom().prefWidth(sizeX);
For example how I can you get the size of a Left side of a BorderPane and set the size?Read the Javadocs. Immediately below the image you link it says
The top and bottom children will be resized to their preferred heights and extend the width of the borderpane. The left and right children will be resized to their preferred widths and extend the length between the top and bottom nodes. And the center node will be resized to fill the available space in the middle.
So you need to set the preferred sizes of the controls you add to these regions. You can also retrieve the size of the same nodes once they've been added to a live scene by calling getWidth() and getHeight() on those nodes.
Maybe you are looking for
-
My Canon Pixma 620 suddenly stopped being recognized by my iMac
For the past year I have had no problems printing with my wireless printer. But as of just two days ago I am no longer able to print. Each time I try to print to my Canon Pixma MP620 printer I get a popup that says The printer is not connected, und
-
Hi All My client's reqmt is that after the APP is run the Payment advice has to go to the bank automatically. That is after me running the APP, that is the Payment is run is over there will be an output ryt that output has to be in the SAP MT940 form
-
Show ONLY my INBOX, not underlying folders
How do I get one-click access to my INBOX, without the underlying folders? Currently the hub shows all of my unread emails in the main view, including all of the unread emails that were automatically filed in other folders (due to Outlook rules I ha
-
ID de Apple By mistake I have open an apple account to unknown email address with bank details, is that a big probl ...
-
Web DB. Someone can help me?
I have to develop a website application with Oracle Web-DB. I can't understand how to make a link in a report that can accept itself as parameter. I mean, I want the user to click on the link, the text of the link must be used for a sql query with ot