Solved

JNI Problem - GetStringChars giving core dump after few repititve operation

Posted on 2001-06-21
4
715 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 300 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

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

Suggested Solutions

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…

770 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