Hey,
  I'm not sure if this is your problem, but you're allocating a really
big chunk of memory on the stack (it makes my embedded code senses
tingle big time).  What are the stack size limits for android?

Tristan Miller

On Jan 10, 8:42 am, nemo <[email protected]> wrote:
> Hi! All:
>
> I've stuggle of this problem few days, search many hours but not sure
> what's I should try.
> Thanks in advance.
> I have a native c function which take jintarray as a parameter, and I
> wanna pass a int array to it.
> I use  GetIntArrayRegion to copy out the content of jintArray.
>
> JNIEXPORT jstring Java_com_google_client_DecodeThread_test( JNIEnv*
> env,
>                                       jobject  this,    jintArray
> verts1 )
> {
>
> jint buf[307200];
> (*env)->GetIntArrayRegion(env, verts1, 0, 307200, buf);
>
> }
>
> It seems work when I call this native function in an activity. (it
> didn't crash ,at least)
> But it always crash when I call this native function in an thread
> which will be called in an activity.
>
> I can't figure out why is that...
> I saw many example, they just pass jintarray...
>
> I also found that If I copy small part of the jintarray, it won't
> crash.
>
> Is there any memory limit of thread ?
> or something related to GC and invalid array pointer?
>
> The following is part of my code.
> Thanks a lot for your help.
>
> in java:
> public native int testmem(int[] img);
>
> private void decode_c()
>   {
> ...
> System.loadLibrary("mydecoder");
> int[] img_int = new int[307200];
> int res= test(img_int );   ----------> it will crash here.I can't even
> find out the error, the application closed.
> ...
>
> }
>
> in native c:
>
> JNIEXPORT jstring Java_com_google_client_DecodeThread_test( JNIEnv*
> env,
>                                       jobject  this,    jintArray
> verts1 )
> {
>
> jint buf[307200];
> (*env)->GetIntArrayRegion(env, verts1, 0, 307200, buf);
>   return (*env)->NewStringUTF(env, "show when no crash!");
>
>
>
> }
-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to