C++ / JNI memory leakage, help needed

G

George Neuner

George said:
However i had tried to use something like this:

return env->NewStringUTF(output);

}
__finally
{
output= NULL;
delete [] output;
size=NULL;

C++ itself doesn't have a "finally" keyword, but Microsoft compilers
support a "try-finally" construct as a language extension.
[...]

This is actually the first posting I am catching from this thread and
sorry, if my posting is already hopelessly late, but what is the point
of assigning NULL to output and then deleting the output (being NULL)?
Shouldn't it be vice versa? For me, it seems like this is THE memory leak.

Yup! ... hopelessly late :cool:

The quoted code definitely leaks. The OP's is new to C++ and his
original code simply forgot to free the string. That error was dealt
with in the thread and the OP's latest inquiries concern C++ language
and compiler issues.

George
=============================================
Send real email to GNEUNER2 at COMCAST o NET
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,012
Latest member
RoxanneDzm

Latest Threads

Top