Freeing object created in JNI code?

Discussion in 'Java' started by Gordon Beaton, Oct 27, 2003.

  1. On 27 Oct 2003 06:44:26 -0800, Tony Tang wrote:
    > If I create new objects in the jni code by calling NewObject(), do I
    > need to explicitly free these objects?


    You don't need to do anything.

    Objects created in native code are no different than objects created
    in Java. They will become eligible for gc when they are no longer
    reachable.

    If you really want to, you can call DeleteLocalRef(), however since
    that happens automatically when the native method returns, it usually
    isn't necessary.

    /gordon

    --
    [ do not email me copies of your followups ]
    g o r d o n + n e w s @ b a l d e r 1 3 . s e
     
    Gordon Beaton, Oct 27, 2003
    #1
    1. Advertising

  2. Gordon Beaton

    Tony Tang Guest

    If I create new objects in the jni code by calling NewObject(), do I
    need to explicitly free these objects? If so, what function do I call?

    Thanks in advance,
     
    Tony Tang, Oct 27, 2003
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. jithoosin
    Replies:
    0
    Views:
    318
    jithoosin
    Jul 21, 2006
  2. jithoosin
    Replies:
    1
    Views:
    287
    Kai-Uwe Bux
    Jul 21, 2006
  3. wolverine
    Replies:
    1
    Views:
    328
    Joost Witteveen
    Jul 21, 2006
  4. Tim Hunter
    Replies:
    0
    Views:
    90
    Tim Hunter
    Nov 25, 2007
  5. G G
    Replies:
    4
    Views:
    97
Loading...

Share This Page