[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

JNI Problem - GetStringChars giving core dump after few repititve operation

Posted on 2001-06-21
4
Medium Priority
?
765 Views
Last Modified: 2012-06-21
jstring str;
char *value;

value = (char *) (*env)->GetStringUTFChars( env,str,NULL);
(*env)->ReleaseStringUTFChars(env,str,value);

Above piece of code gets executed for each field of an Java object. It gives a core dump after executing successfully for some field at one specefic point.

Re-arranging the position of the field also gives the error after certain number of execution.

I don't do anything with the value as well, just retrieve it and then release it. It still gives an error.


Any pointer?????????????
0
Comment
Question by:jatinps
  • 2
4 Comments
 
LVL 92

Expert Comment

by:objects
ID: 6216556
Simply assigning finalValue to value just gives you two pointers to the SAME block of memory. Then in the next line you release this block of memory so finalValue is no longer pointing to a valid block of memory.
0
 
LVL 92

Accepted Solution

by:
objects earned 1200 total points
ID: 6216558
You need to either delay releasing the block until you no longer need it, or take a copy of the block.
0
 
LVL 5

Expert Comment

by:vemul
ID: 7621054
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
- points to objects
Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER !

vemul
Cleanup Volunteer
0
 

Expert Comment

by:modulo
ID: 7643130
Finalized as proposed

modulo

Community Support Moderator
Experts Exchange
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses
Course of the Month20 days, 2 hours left to enroll

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question