First of all I'd like to appologise... I know this theme might be missplaced, but in Sun Java Forums nobody was able to come up with a solution. If you know a better forum to place it, please let me know.
I have an application that launches several threads of different types. One of them is quite specific and run a critical JNI C++ process. The remaining ones are just for controling of other stuff... When I call the application by the command line
java -classpath ... -Xss20m -Djava.library.path ... pack.subpack.myApp
the application usually crashes: My computer has 256MB RAM of memory that vanish in seconds and causes an OutOfMemoryException
Sometimes the application works properly, but sometimes the memory usage goes up fast until a general crash.
What I believe that is going on:
When we declare -Xss20m, I undestand that for each thread the JVM will attemp to allocate more 20MB, and if I have 10 threads, it goes up to 200MB and so on; however I'd like to have 20MB just for my critical process (that is called in one specific thread) and not for any thread.
If I try to reduce -Xss parameter to, let's say 10MB, my C++ process overflow the JVM stack for the thread.
So, does any body have know how to solve it? Please... I need experts help!
Thanks a lot,