[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn commit: r1676769 - /subversion/trunk/subversion/bindings/javahl/native/CreateJ.cpp

From: Philip Martin <philip.martin_at_wandisco.com>
Date: Thu, 30 Apr 2015 13:17:06 +0100

Branko Čibej <brane_at_wandisco.com> writes:

> The more important part of this change was the addition of
> POP_AND_RETURN_NOTHING at the end of the function (that you don't
> quote), because that actually destroys ("pops") the current local JNI
> frame and cleans up any remaining local references within it. We were
> leaking a whole frame, not just the single object reference in the loop,
> and that was affecting other code that happened to be in proximity to
> the call sites of this function.

I have to relearn this JNI stuff every time I look at it. The local
refs are cleaned up automatically on return from the native code because
the JVM wraps the native call in PushLocalFrame/PopLocalFrame. We use
DeleteLocalRef to control the number of local refs during the native
call.

The problem in this case was a missing PopLocalFrame which I guess means
that the JVM is not tracking the stack depth to automatically pop any
frames pushed by the native code. I think that means we may still have
a problem in this function with the bare returns:

>>> if (JNIUtil::isJavaExceptionThrown())
>>> return;

-- 
Philip Martin | Subversion Committer
WANdisco // *Non-Stop Data*
Received on 2015-04-30 14:17:44 CEST

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.