Solved

JNI Problem - GetStringChars giving core dump after few repititve operation

Posted on 2001-06-21
4
725 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How do I remove an object from a 3 60
JDBC performance 8 33
Html split(text) 2 48
Strange router problem - can't access hotmail.com 14 108
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…
For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
Suggested Courses

734 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