How to specify for JVM the stack for ONE specific thread that invokes JNI

Hello all!
I'm 2 days now looking for a solution in several forums but even 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.
Description:
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,
Calegari

There we go...
I have this class:
package calegari.automata;
* <p>Title: </p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2003</p>
* <p>Company: </p>
* @author Aur�lio Calegari
* @version 1.0
public class Native {
* Parameters:
* individuals --> All binary individual (AC rule)
* indivLength --> number of infividuals
* numEval --> number of RIs
* generateUniform --> Uniform distribution of density
* seed --> seed for current generation
public native double[] AutomataIterator(int[][] individuals,
int indvLength,
int numEval,
boolean generateUniform,
long seed
static {
System.loadLibrary("Native");
public Native() {
Then, running
javah -classpath ... calegari.automata.Native
I'll get the following .h
/* DO NOT EDIT THIS FILE - it is machine generated */
#include "jni.h"
/* Header for class calegari_automata_Native */
#ifndef Includedcalegari_automata_Native
#define Includedcalegari_automata_Native
#ifdef __cplusplus
extern "C" {
#endif
* Class: calegari_automata_Native
* Method: AutomataIterator
* Signature: ([[IIIZJ)[D
JNIEXPORT jdoubleArray JNICALL
Java_calegari_automata_Native_AutomataIterator___3_3IIIZJ
(JNIEnv *, jobject, jobjectArray, jint, jint, jboolean, jlong);
#ifdef __cplusplus
#endif
#endif
Next, I built my cpp file which is right bellow
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include "jni.h"
#include "calegari_automata_Native.h"
#include "util.h"
double IndividualEvaluator(long rule[], int automataCells[][149], int numInit1s[],
int numOfACs, int numEvaluations);
char getNext(char simb);
JNIEXPORT jdoubleArray JNICALL
Java_calegari_automata_Native_AutomataIterator___3_3IIIZJ
(JNIEnv *env, jobject jobj, jobjectArray indiv, jint length, jint numEval,
     jboolean isUniform, jlong seed)
printf("Native JVM call for C++ critical block: Started \a[-]");
int ACs[10000][149]; //Will be filled with 100000 Initial states of a cellular automata
int numIndiv = length;
int numOfACs = numEval;
//Dencity of each Initial state of cellular automata
int num1sRIs[10000];
//response
double resp[1000];
//set seed
srand((unsigned int) seed);
//generate Cellular automata states
//Uniform generation
if(isUniform)
for(int i=0;i<numEval;i++)
int num1s;
num1s=0;
for(int j=0;j<149;j++)
ACs[i][j] = ((rand()%numEval)<i+1?0:1);
if(ACs[i][j]==1) num1s++;
num1sRIs[i] = num1s;
printf(" %d ",num1s);
else //not uniform generation
for(int i=0;i<numEval;i++)
int num1s;
num1s=0;
for(int j=0;j<149;j++)
ACs[i][j] = rand()%2;
if(ACs[i][j]==1) num1s++;
num1sRIs[i] = num1s;
//load individuals and start the critical method
char simb = '-';
for(int i=0;i<numIndiv;i++)
jintArray oneDim = (jintArray) env->GetObjectArrayElement(indiv, i);
jint *indiv=env->GetIntArrayElements(oneDim, 0);
simb = getNext(simb);
printf("\b\b%c]",simb);
resp[i] = IndividualEvaluator(indiv,ACs,num1sRIs,numOfACs,300);
jdoubleArray retApts;
retApts = env->NewDoubleArray(numIndiv);
env->SetDoubleArrayRegion((jdoubleArray)retApts,(jsize)0,numIndiv,(jdouble *)resp);
printf("\nReturning to Java plataform: Completed\a\a\n");
return retApts;
char getNext(char simb)
if(simb=='-') simb = '\\';
else if(simb=='\\') simb = '|';
else if(simb=='|') simb = '/';
else if(simb=='/') simb = '-';
return simb;
Then it works fine since we declare the size of the stack to JVM, however, if we don't... We get a crash!
Any idea?
Thanks

Similar Messages

  • I signed up for my apple account while living in Canada, and now I lives in the US. I am looking for a specific app that apparently is only available through the US app store. How can I change my account to the US Apple Store?

    I signed up for my apple account while living in Canada, and now I lives in the US. I am looking for a specific app that apparently is only available through the US app store. How can I change my account to the US Apple Store?

    As long as you have a form of payment (credit or debit card) with a USA source, and with a billing address in the USA, then you just need to change your payment information on your account to that, change your country in the store settings, and you will then be able to shop in the USA store.
    Your AppleID will work in any country's store, as long as your payment source and billing addres are also specific to that country (and you are in that country as well, as there may be IP filters in place to stop use outside of the country).

  • HT204266 how to search for a specific app eg tetris in the app store?

    Hi is there anyone that can please help me on how to search for a specific app eg tetris in the app store? Thanks

    Hi Friend,
    You just write down the name of the app or for what the app is used for (eg, write down Notes and then will appear a lot of options), then download what you wish.
    Hope it will be helpful

  • I am new sto Lightroom and have also just changed from Apple to PC.  I cannot figure out how to download photos from the Photoshop library to a file that will be sent to MPIX for processing.  Also, does Lightroom have an easy access to a photo processing

    I am new to Lightroom and have also just changed from Apple to PC.  I cannot figure out how to download photos from the Photoshop library to a file that will be sent to MPIX for processing.  Also, does Lightroom have an easy access to a photo processing capability such as MPIX?

    Use the trackpad to scroll, thats what it was designed for. The scroll bars automatically disappear when not being used and will appear if you scroll up or down using the trackpad.
    This is a user-to-user forum and most people will post on here if they have problems. You very rarely get people posting to say there update went smooth. The fact is the vast majority of Mountain Lion users will not be experiencing any major problems with the OS, or maybe with apps which are not compatible, but thats hardly Apple's fault if developers don't update their apps.

  • HT3211 new, how do i turn off the dialog box at bottom left that is giving commands for macbook air?

    new, how do i turn off the dialog box at bottom left that is giving commands for macbook air?

    try "command+F5"

  • How do I set up two libraries on one pc so that we have two separate libraries for each iPhone?

    How do I set up two libraries on one pc so that we have two separate libraries for each iPhone?

    Launch it with the Shift key held down, or create a second Windows user account.
    (60390)

  • A pool operation was specified for a pooled resource that does not belong t

    hi i left the server running for days so my application was running i refresh the page by clicking the ok button in small popup box,the page was refresh but when i what to select my lov am geting this error
    A pool operation was specified for a pooled resource that does not belong to the resource pool.
    Error     
    java.lang.NullPointerException
    Caused by: java.lang.NullPointerException
         at oracle.adf.model.binding.DCIteratorBinding.initSourceRSI(DCIteratorBinding.java:1797)
         at oracle.adf.model.binding.DCIteratorBinding.callInitSourceRSI(DCIteratorBinding.java:1672)
         ... 187 more
    ## Detail 0 ##
    java.lang.NullPointerException
         at oracle.adf.model.binding.DCIteratorBinding.initSourceRSI(DCIteratorBinding.java:1797)
         at oracle.adf.model.binding.DCIteratorBinding.callInitSourceRSI(DCIteratorBinding.java:1672)
         at oracle.adf.model.binding.DCIteratorBinding.internalGetRowSetIterator(DCIteratorBinding.java:1645)
         at oracle.adf.model.binding.DCIteratorBinding.getRowSetIterator(DCIteratorBinding.java:1607)
         at oracle.jbo.uicli.binding.JUCtrlListBinding.setupListItems(JUCtrlListBinding.java:725)
         at oracle.jbo.uicli.binding.JUCtrlListBinding.getDisplayData(JUCtrlListBinding.java:3586)
         at oracle.adfinternal.view.faces.model.binding.FacesCtrlListBinding$1.size(FacesCtrlListBinding.java:382)
         at java.util.AbstractList$Itr.hasNext(AbstractList.java:339)
         at oracle.adfinternal.view.faces.renderkit.rich.SelectItemUtils.addSelectItems(SelectItemUtils.java:207)
         at oracle.adfinternal.view.faces.renderkit.rich.SelectItemUtils.getSelectItems(SelectItemUtils.java:78)
         at oracle.adfinternal.view.faces.renderkit.rich.SimpleSelectOneChoiceRenderer.getSelectItems(SimpleSelectOneChoiceRenderer.java:98)
         at oracle.adfinternal.view.faces.renderkit.rich.SimpleSelectBaseRenderer._renderContent(SimpleSelectBaseRenderer.java:208)
         at oracle.adfinternal.view.faces.renderkit.rich.SimpleSelectBaseRenderer.renderElementContent(SimpleSelectBaseRenderer.java:122)
         at oracle.adfinternal.view.faces.renderkit.rich.FormInputRenderer.encodeAllAsElement(FormInputRenderer.java:152)
         at javax.faces.component.UIComponent.encodeAll(UIComponent.java:937)
         at org.apache.myfaces.trinidad.render.CoreRenderer.encodeChild(CoreRenderer.java:405)
         at oracle.adf.view.rich.render.RichRenderer.encodeChild(RichRenderer.java:2633)
         at oracle.adfinternal.view.faces.renderkit.rich.PanelStretchLayoutRenderer.encodeCenterFacet(PanelStretchLayoutRenderer.java:769)
         at oracle.adfinternal.view.faces.renderkit.rich.PanelStretchLayoutRenderer._encodeCenterPane(PanelStretchLayoutRenderer.java:1140)
         at oracle.adfinternal.view.faces.renderkit.rich.PanelStretchLayoutRenderer._encodeMiddlePanes(PanelStretchLayoutRenderer.java:348)
         at oracle.adfinternal.view.faces.renderkit.rich.PanelStretchLayoutRenderer.encodeAll(PanelStretchLayoutRenderer.java:313)
         at oracle.adf.view.rich.render.RichRenderer.encodeAll(RichRenderer.java:1396)
         at org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:341)
         at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:767)
         at javax.faces.component.UIComponent.encodeAll(UIComponent.java:937)
         at org.apache.myfaces.trinidad.render.CoreRenderer.encodeChild(CoreRenderer.java:405)
         at oracle.adf.view.rich.render.RichRenderer.encodeChild(RichRenderer.java:2633)
         at oracle.adf.view.rich.render.RichRenderer.encodeStretchedChild(RichRenderer.java:2004)
         at oracle.adfinternal.view.faces.renderkit.rich.PanelSplitterRenderer._renderPane(PanelSplitterRenderer.java:1360)
         at oracle.adfinternal.view.faces.renderkit.rich.PanelSplitterRenderer.encodeAll(PanelSplitterRenderer.java:279)
         at oracle.adf.view.rich.render.RichRenderer.encodeAll(RichRenderer.java:1396)
         at org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:341)
         at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:767)
         at javax.faces.component.UIComponent.encodeAll(UIComponent.java:937)
         at org.apache.myfaces.trinidad.render.CoreRenderer.encodeChild(CoreRenderer.java:405)
         at oracle.adf.view.rich.render.RichRenderer.encodeChild(RichRenderer.java:2633)
         at org.apache.myfaces.trinidad.render.CoreRenderer.encodeAllChildren(CoreRenderer.java:421)my lov is empty,but where i restart Instance IntegratedWebLogicServer all is fine what cause this error
    Edited by: adf009 on 2013/04/03 9:28 AM
    Edited by: adf009 on 2013/04/03 1:13 PM

    Try:
    - Powering off and then back on your router.
    - iTunes for Windows: iTunes cannot contact the iPhone, iPad, or iPod software update server
    - Change the DNS to either Google's or Open DNS servers
    Public DNS — Google Developers
    OpenDNS IP Addresses
    - For one user uninstalling/reinstalling iTunes resolved the problem
    - Try on another computer/network
    - Wait if it is an Apple problem

  • How to stop update notification for one app (iMovie) that I do not want to update

    How to stop update notification for one app (iMovie) that I do not want to update. I do not want iMovie 10 taking up nearly 3 gb on my hard disc. iMovie 9 is just fine and only takes up 1.5 gb. But I get notifications to update and don't know how to turn it off. I've gone into the Purchases tab of the App store and deleted it. I don't want to turn off Update notifications (which is irrelevant in any case because I see no option to do that in Notifications system preference pane). I just don't want to be bugged about iMovie updates. The only option I'm given is to postpone the next reminder until the next morning. -- Franklin

    Interesting; never came across that - here is the window I get (just double clicked on a random doc in the trash):

  • How do I make all the clips on one track the same volume?

    I am trying to raise the volume equally on all the clips. One would think that it would be as simple as turning up the volume knob on the audio mixer on the track with all the clips, but of course not, that would be TOO simple. When I raise the volume, it keeps jumping back and forth as if I asked it to key frame the volume knob. How can I perform the simple task of raising all the clip volumes to the same volume ?

    VideoHero
    I do not recall what version of Premiere Elements that you are using nor the computer operating system on which it is running.
    So, I will generalize for now, referencing version 12...
    1. Assuming you have several Timeline audio clips that you want with the same volume...select the first, go to Adjust Tab/Adjustments Palette/Volume Panel expanded and adjust the Volume.
    2. Then right click the that first file (with the adjusted Volume), select Copy.
    3. Select all the other audio clips that you want to have the same Volume level. Then right click anywhere in the selection and select Paste Effects and Adjustments.
    Does that work for you.
    If you have video with its audio linked to it, depending on the specific circumstances to be discussed later, you might want to unlink the audio and video beforehand.
    Please review and let us know if that works for you. Any questions or need clarification, please do not hesitate to ask.
    Thanks.
    ATR

  • Changing proposed delivery date in sales order for one specific sales org

    Hi All,
    I want to change proposed delivery date in sales order automatically for one specific sales org only without changing lead time in VOV8.
    For that can I use MV45AFZZ. But it is asking access key to make changes. Is there any other user exit for the same. And how does exactly change it.
    Thanks in advanced.
    Points will be awarded.
    Regards,

    EXIT_SAPFV45E_001 has nothing to do with this - it is meant to update the purchase order from a sales order. It might not even be triggered if the sales order has no link to a purchase order.
    USEREXIT_SAVE_DOCUMENT is not really good for this either, because the delivery date has to be changed before that. If memory serves, it also influences the schedule lines and probably the ATP check and such. I would strongly advise against it. One of the other routines in MV45AFZZ should do just fine, USEREXIT_MOVE_FIELD_TO_VBAK for example.

  • How to turn off all the layers in one go?

    How to turn off all the layers in one go?
    In case the pdf file contains layers, then how to turn them all off in one go?
    Thank you for the help,
    Best
    Jamal

    able,
    What happens if you select both the grunge and the image and in the Transparency flyout tick Make Opacity Mask? You may try different ticking/unticking and colours.

  • When I click Sign, Adobe Reader XI v 11.0.4, my only option is Sign with Certificate, how do I also get the "I need to Sign" option that allow me to place a signature?

    When I click Sign, Adobe Reader XI v 11.0.4, my only option is Sign with Certificate, how do I also get the “I need to Sign” option that allow me to place a signature? I need screen shots to develop a customized training pamphlet.

    Hi,
    Please update the Reader to 11.0.07 and then check the options.
    Go to Help -> Check for updates.
    Regards,
    Anoop

  • HT1911 How do i change/find the answer to one of the questions like; "who is your favorite teacher?"

    How do i change/find the answer to one of the questions like; "who is your favorite teacher?" I need to be able to buy stuff off of my computer.

    Go to:
    https://appleid.apple.com/
    Click "Manage My Account", sign in, and go to the Password and Security section. Answer the security questions and you'll be taken to a screen where you can then change them. If you've forgotten your answers, there should be a link just under the security questions fields where you can have a reset email sent to your Rescue email address. If the link for the email doesn't appear, as can happen if you didn't set a rescue email address or (apparently) have a .Mac email address, go here:
    http://www.apple.com/emea/support/itunes/contact.html
    to report the issue to the iTunes Store.
    Regards.
    Forum Tip: Since you're new here, you've probably not discovered the Search feature available on every Communities page, but next time, it might save you time (and everyone else from having to answer the same question multiple times) if you search a couple of ways for a topic, both in the relevant forums and in the Apple Knowledge Base, before you post a question.

  • Combining Skype Subscription for one specific coun...

    I have purchased a subscription for one specific country which I call the most. For other countries, I simply purchased some Skype credit.
    How can I make sure that my credit will not run out when I am calling that specific country that I have the subscroption for?

    NormanM wrote:
    Hello,
    The fault is almost certainly with the local Indian carrier used to terminate the call and not Skype. (All Skype calls travel via the internet and only convert to PSTN/Cellular networks at a point close to the recipient's phone). The fact that your Skype-to-Skype calls are trouble-free demonstrates the point. You can also check by placing a free call to the Skype Call Testing Service (echo123).
    First of all thanks for your reply and also you mentioned something PSTN/Cellular network etc etc how the Skype is working. But look here my problem is why this is happening, the subscription name itself India calling then Skype should be able to tieup or catch up with the local Indian carrier, isn't it? How do I know that the local carrier is supporting or not? I need a solution not the reason, yeah it is good to know the reason but what I will do with the reason here; it is beyond my doing. If this is the genuince reason for the failure then Skype is making false statement and fooling around the customers saying you can call Indian Mobile and land lines by this subscription, which is clearly not happening.
    Please let me know if there is anything can be done on this issue, yours time and effort is appreciately greatly.
    regards
    Unsatisfied Skype Customer

  • My friend bought an ipad mini and gave me his old iPad. how can i re-register the iPad in my name so that i can sync it with my macbook air?

    My friend bought an ipad mini and gave me his old iPad. how can i re-register the iPad in my name so that i can sync it with my macbook air?

    Setup as new
    Settings>General>Reset>Erase all content and settings

Maybe you are looking for

  • Unable to open file: ~/file as it is in use by "user"

    I have a user connected to a network account. For some reason they are getting an error whenever they try to open a Powerpoint document. The error message says that the file can't be opened as it's currently in use by the same user, and prompts to op

  • What is the best outdoor AP that compatible with the WLC 5508?

    Dear All, hope my email finds you well i'm searching for the bes Wireless Outdoor AP that is compatible with WLC 5508 (has a lightweight Image)? I used befor the 1310 LAP but it was nightmare to me, so I do not like to use it again and i'm searching

  • Setting up new taxes in US in TAXUSJ - to handle federal excise tax

    Hi - We use SAP standard US tax setting using jurisdiction code. We have a new type of taxes - we need to set up - Federal excise taxes. This is only applicable for some materials. We will post document from SD. We are setting a new condition type an

  • 890fx board having touble with ethernet connection

    i own an 890 fx mother board and i am having trouble connecting to the internet through my ethernet cable. i have checked the cables to make sure they work and i have checked both of my ethernet ports neither of them work. the internet through the po

  • My iphone is stuck in recovery mode after 8.0.2

    I have an Iphone 5S. Yesterday I tried 2 times to upgrade to 8.0.2 having skipped 8.0 and 8.0.1 after all the negative reviews. However, both times (once through wifi, second time connected to Itunes), my phone ended up in recovery mode: black screen