Need to delete local references in unknown calling context

Hi,
I was looking for the need to delete local references and came across this documentation,
What does unknown caller context mean? and how does it cause local references to remain allocated in reference table although the native function returns?
http://java.sun.com/docs/books/jni/html/refs.html
5.2.1 Freeing Local References
You want to write a utility function that is called from unknown contexts. The MyNewString example shown in Section 4.3 illustrates the use of Delete-LocalRef to delete promptly local references in a utility function. Otherwise there will be two local references that remains allocated after each call to the MyNewString function.

how does it cause local references to remain allocated in reference table although the native function returns?Because it doesn't return to the JVM where it gets deallocated, it returns to the unknown caller context, i.e. some other piece of native code in your JNI layer. So the references remain until the unknown caller context returns to the JVM.

Similar Messages

  • I need to delete local e mail folders, how do I do it?

    I have many old e mail folders, filled with old e mails, no longer wanted.
    I have to scroll down past many of these to find the folder I am after. How do I delete these unwanted & old folders?

    Firefox is just a web browser and has no built-in email features, any email accessed through Firefox will be a webmail based system. Any features of the email will be part of the webmail service that you are using. You will need to contact the support for the email service to see how to delete the folders.

  • JNI freeing local references

    We're using JNI to receive data from a native callback function. The native side creates local references, but does not use the DeleteLocalRef function. This works fine with the SUN JRE.
    However, the IBM JRE gets a stack overflow exception.
    According to IBM, we should delete the local references, but this requires a total rewrite of our program.
    Unfortunately, the JNI documentation is not very clear on this topic. In our understanding, the local references are being released automatically once they are out of scope.
    Is it really necessary to delete the local references or is there a bug in the IBM JRE ?
    Sample program :
    ==============
    // JNITest.java
    interface INativeNotification
    public void nativeCallBack();
    class JNITest implements INativeNotification
    private long counter;
    public native void nativeInitialize(INativeNotification callbackNotification);
    static {
    System.loadLibrary("JNITest");
    public void nativeCallBack() {
    System.out.println("JNITest CallBack " + counter++);
    public void run() {
    nativeInitialize(this);
    counter = 0;
    while(true)
    try {
    Thread.sleep(1000);
    } catch(Exception e) {
    public static void main(String[] args) {
    JNITest jnitest = new JNITest();
    jnitest.run();
    // JNITest.cpp : Defines the entry point for the DLL application.
    #include "stdafx.h"
    #include "JNITest.h"
    static DWORD dwThreadId;
    static HANDLE hThread;
    static HANDLE volatile hInitCompleteEvent;
    static bool volatile bLoop = true;
    static JavaVM *jvm = NULL;
    static jobject nativeNotification;
    BOOL APIENTRY DllMain( HANDLE hModule,
    DWORD ul_reason_for_call,
    LPVOID lpReserved )
    return TRUE;
    bool DoNativeCall(JNIEnv *env)
    jclass cls = env->GetObjectClass(nativeNotification);
    jmethodID callbackMethod = env->GetMethodID(cls, "nativeCallBack", "()V");
    env->CallVoidMethod(nativeNotification, callbackMethod);
    if ( env->ExceptionOccurred() )
    env->ExceptionDescribe();
    env->ExceptionClear();
    printf("Native code got exception calling nativeCallBack\n");
    return(false);
    return(true);
    DWORD WINAPI JNIThread( LPVOID lpParam )
    JNIEnv *env = NULL;
    jvm->AttachCurrentThread((void**)&env,NULL);
    SetEvent(hInitCompleteEvent);
    while (bLoop)
    if (!DoNativeCall(env))
    bLoop = false;
    Sleep(1);
    env->DeleteGlobalRef(nativeNotification);
    jvm->DetachCurrentThread();
    return 0;
    * Class: JNITest
    * Method: nativeInitialize
    * Signature: ()V
    JNIEXPORT void JNICALL Java_JNITest_nativeInitialize(JNIEnv *env, jobject object, jobject _nativeNotification)
    DWORD dwThrdParam = 0;
    env->GetJavaVM(&jvm);
    nativeNotification = env->NewGlobalRef(_nativeNotification);
    hInitCompleteEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
    hThread = CreateThread( NULL, 0, JNIThread, &dwThrdParam, 0, &dwThreadId );
    if (hThread == NULL)
    env->DeleteGlobalRef(nativeNotification);
    return;
    WaitForSingleObject(hInitCompleteEvent, INFINITE);

    Hi,
    First of all, thank you for your time and interest.
    Let me first recapitulate the history of this problem :
    We have a C interface for controlling our HW boards. A few years ago, we wrote a java interface for one of our customers. This JNI wrapper was certified for the SUN JRE and has been used for several years now without a problem. There are several java and native callback functions in this wrapper and our development team took some design decisions (e.g. no DeleteLocalRef's, re-fetching the jclass and methodID in the callback functions, ...).
    Recently, one customer asked us to use this wrapper with the IBM JRE. At first, there seemed to be no porting issues. However, after running for a very long time, we had a stack overflow.
    Our customer reported this problem to IBM and finally, after sending a sample program (see my first post), IBM confirmed that there was a problem in their JVM. They provided a fix, but this fix only deleted local references which were created in a GetObjectClass call. After providing a few other fixes which did not provide a proper solution either, they suddenly changed their strategy and claimed that we have to delete all the local references which are created in a thread, otherwise we're not JNI compliant.
    However, when we look in the IBM JVM diagnostics guide (Chapter 6 : Understanding the Java Native Interface, see http://www-106.ibm.com/developerworks/java/jdk/diagnosis/), they provide the following code as a sample for loosing local references, resulting in the underlying object being garbage collected.
    jobject myJNIfunc1 ()
    return env->NewObject ();
    void myJNIfunc2 ()
    jobject obj;
    obj = myJNIfunc1 ();
    .. -> no local reference to obj exists, and the garbage collector can collect it
    Are we interpreting the IBM JVM diagnostics guide wrong or is there a problem in the IBM JVM ?
    The SUN JVM deletes the local references properly.

  • HT201250 How do I find and delete local backups.  This is taking up over 200g of space on my MBP

    I recently looked at my hard disc drive and backups were taking over 200gb of space.  I used the terminal command to stop taking local backups, but when I rechecked disc space it only moved the space from backup to other. 
    Is there a way to find and delete this files?  Then I can start fresh with Time Machine.
    Thanksm
    Tp

    You don't need to delete local snapshots. They're delete automatically when free space falls below a certain level.

  • RunState.Caller.Locals.ReportOptions.Directory unknown in Teststand 2013

    Hello,
    I have a problem due to migration between TestStand 4.1.2 and TestStand 2013.
    In previous sequences I used the variables: RunState.Caller.Locals.ReportOptions.Directory, RunState.Caller.Locals.StartDate.Text, RunState.Caller.Locals.UUT.SerialNumber, RunState.Caller.Locals.ReportFilePath and others... without problem.
    Now in TestStand 2013, the variables cannot be evaluated , generates an Teststand error and thus I cannot personnalize my report name and directory.
    Hereafter the complete expression that cause problems:
    RunState.Caller.Locals.ReportOptions.Directory=FileGlobals.Report_Directory + "\\" + RunState.Caller.Locals.StartDate.Text + "\\" + RunState.Caller.Locals.UUT.SerialNumber ,
    RunState.Caller.Locals.ReportFilePath=FileGlobals.Report_Directory + "\\" + RunState.Caller.Locals.StartDate.Text + "\\" + RunState.Caller.Locals.UUT.SerialNumber + "\\" + "Report ["+ RunState.Caller.Locals.UUT.SerialNumber +"][" + Str(RunState.Caller.Locals.StartTime.Hours) +" "+ Str(RunState.Caller.Locals.StartTime.Minutes) +" "+ Str(RunState.Caller.Locals.StartTime.Seconds) + "]" + ".html",
    FileGlobals.UUT_Time = "[" + RunState.Caller.Locals.UUT.SerialNumber+"][" + Str(RunState.Caller.Locals.StartTime.Hours) +" "+ Str(RunState.Caller.Locals.StartTime.Minutes) +" "+ Str(RunState.Caller.Locals.StartTime.Seconds) + "]" , FileGlobals.fileDir=RunState.Caller.Locals.ReportOptions.Directory 
    Thanks for your help.

    If you using these expressions to set the report path and directory, then, do consider using TestStand expression to specify the report path in Report Options dialog. Its lot easier to use compared to setting values to subproperties of Runstate.Caller.Locals.ReportOptions variable.
    You can get more information in the following links
    http://zone.ni.com/reference/en-XX/help/370052K-01/tsref/infotopics/specifyreportfilepath_byexpressi...
    http://zone.ni.com/reference/en-XX/help/370052K-01/tsfundamentals/infotopics/reports_expressions/
    http://digital.ni.com/public.nsf/allkb/78E88742D0F8C3C5862576D4006B8E44
    Coming to your error, please provide more information regarding which sequence file and sequence did you modify.
    Also note that, in TestStand 2012, process models had major change to support plug-in architecture. Process models without the plug-in architecture (like the one used in TestStand 4.1.2) is installed in "<TestStand>\Components\Models\TestStandModels\TestStand 2010 Process Models (Legacy)" directory. If you want to migrate your process model changes, it might be valid to update the legacy process models instead of new models.
    You can see brief description of TestStand 2012 process model changes in http://zone.ni.com/reference/en-XX/help/370052K-01/tshelp/infotopics/2012whatsnew/#plugin
    - Shashidhar

  • Want External Phone Number Mask to say "Unknown Caller" Is this Possible?

    When a user dials an external # is it possible to have it show on Caller ID as "Unknown Caller"?
    I have deleted the # that is currently in the External Phone Number Mask, and left it blank, but the Coporate# now shows when he dials out.
    This is something that only needs to be setup for 1 user, not the entire company.

    There will always be some number/name displayed. If you do not put in a number in the outside mask, the number/name associated with the smart trunk will be displayed.
    You might talk to your local phone company and see if they can restrict the numbers or a single phone number. If they can do that on even one number, you can put it into the mask for all of your phones.
    Two other problems you might have with this. One, a lot of people (I do) block calls from phones that do not display a phone numbers.
    Another problem you are going to run into is when someone calls "911" by accident. The Police/fire will try to call back to the number for the smart trunk. And since most often is not on a phone. They will send cars or trucks to the address listed for those smart trunks. Usually the billing address for your company.

  • Close reference needed for step object reference open? If so, how?

    Hello,
    We are using an activex method call to open an object reference to a step and programatically rename it.  This is done many many times during our test run, thousands.  We ran into an "out of memory" problem we had never seen before during a 72 hour test run, and in hunting down any possible memory leaks, I am wondering if a corresponding close is needed for the step reference open we are doing, and how.  I have hunted around the different methods/properties, and can't seem to find if there is a step reference close.  I have attached the specify module screen of the activex call which opens the step reference.
    Thanks for any replies
    David Jenkinson
    Message Edited by david_jenkinson on 06-11-2007 05:07 PM
    Attachments:
    step reference specify module.png ‏25 KB

    Hi David,
    Setting a reference to nothing in TestStand will close it. However, if you are assigning a new value to the local it also frees the memory associated with the original value, making it so you don't need to assign it to nothing. I don't believe the source of the leak is in this step.
    Test Engineer - CTA

  • Local references...some questions...

    Hi All,
    1)
    i have a native method, which i'm calling frequentely. In this method i return one object to Java language....Weird is, if i put -verbose:jni parameter to JVM ....then i receive a lot of allerts ... that a local references count has stepped over the maximum limit 16....
    According to this, i put a env->EnsureLocalCapacity(1) call
    before
    return env->NewObject(.....) statement
    and problem wen't away....But i don't understand this, i assumed that JVM release any local references returned to Java....?????
    2) Is this code correct???
    env->EnsureLocalCapacity(1);
    env->PushLocalFrame(1);
    jobject obj = env->NewObject(....) // no local references are created here..
    obj = env->PopLocalFrame(obj);
    return obj;
    Thanks ....

    efrizzell --
    The use of local base calendars in a Project Server environment is strictly the decision of each organization.  There are certainly valid reasons for permitting them, such as when PMs need to be able to create their own custom local base calendars.
     There are also valid reasons for denying their use, so that every project must be scheduled using a valid and tested base calendar created by the Project Server administrator.
    Several years ago, I worked with an organization that initially forbid the use of local base calendars.  Because of this, the Project Server administrator was hit with dozens of requests for custom enterprise base calendars.  He found the process
    of creating and maintaining enterprise base calendars to be so much work that he gave up trying to control it, and enabled the permission to allow PMs to create their own local base calendars.
    If your organization allows the use of local base calendars, the base calendar will be stored in the project in which it was created.  Hope this helps.
    Dale A. Howard [MVP]

  • How many ways to read and write a local variable in a called VI?

    Ciao!
    I'm producing my first TestStand sequence. It is called "FirstAttempt" and it is made by a single step which calls a VI. One of the first dilemmas i encountered realizing this sequence is how to read and write a local variable (created going in Variables -> Locals ('FirstAttempt') -> <right click to insert local>) in the called VI.
    The first way (the only one i tried) is to create a control and an indicator on the VI front panel, connect them to their respective terminals in the connector pane and then specify (going in Step Settings -> Module) that these connectors (shown in the Parameter Name column) are linked to the local variable (selected in the Value column).
    The second way (not tried) consists in using TestStand API: create a Sequence Context reference on the VI front panel, link it to a property node in the block diagram, select the property "Locals" and extract from this the local variable name and value which, i think, can be readable and writable.
    So...
    Are the shown ways correct?
    Are there other ways?
    Knowing that a "local" variable can be considered "global" within the whole sequence, is there the possibility to simply create a reference to the local variable and use the reference in the called VI block diagram in order to save space in the connector pane (if using method 1) or in the block diagram (if using method 2)?
    Thanks!
    Message Edited by aRCo on 09-17-2009 05:09 AM

    Hi,
    Before TestStand 3 you would use the second way you quoted as its the only way.
    But now you would use the first way you quoted. You may still what to pass the SequenceContext if you were going to use the TestStand API. For TestStand 3.x and above you would use this way as the first chose. (Personnelly, I would not pass the SequenceContext into a VI if I know it was never going to be used in that VI.)
    Not sure I understand your final comment, maybe you are liking it to passing the reference of a control to a subVI so that the control can be updated from within the subVI.
    If this is the case and you had a situation where you had a step that was running in parallel with the rest of the steps in the sequence either as a separate thread or execution and were dependent on the contents of the  local variable changing from that parallel running step, then you would have to use the API SetVal method to change the local.
    Hope this is clear.
    Regards
    Ray Farmer
    Regards
    Ray Farmer

  • Relocated iPhoto to external hard drive - now need to delete old library.

    I have relocated my iPhoto library to my external hard drive. I did this due to space issues on my internal hard drive. Now I need to delete my iPhoto library on my internal hard drive to give me more memory. What is the best, easiest, and safest way to delete? Thank you so much!

    Before you delete anything:
    1.) Make sure the drive you put your library on is Mac OS formatted. Click on the drive icon and go to File > Get Info and check the "Format". If it isn't Mac formatted, reformat the drive and re-copy the library over.
    2.) Tell iPhoto to look at your library on the external drive to make sure it has all the pictures you want. Hold down option key and launch iPhoto and choose the library on the external drive to see within it.
    3.) Do you have a backup? I have my library on an external drive like you do. I have another external drive that backs up my computer and the drive with the library on it. External drives are relatively inexpensive (You can also backup using DVDs although if you have a large library it might take quite a few disks.)
    __You will see it said over and over here on the discussion boards. If you have information that is important to you, have a backup.
    <hr>
    To Delete your library:
    In the Dock (long strip of icons at the bottom of the computer screen) click on the Finder icon.
    Look in the sidebar on the left hand side of the resulting window. You will see the Home.
    __Inside the Home go to the folder called "Pictures". Drag the iPhoto Library from the Pictures folder to the trash and empty the trash.
    Hope that helps.

  • Need to delete data from main table and all child tables ...

    hi all,
    i need to delete rows pertaining to perticular table and all the child
    tables basing on certain code.i need to write a procedure to which i will
    pass the table name and code..
    like del_info(tab_name,code)
    example:
    suppose if i call as del_info(clients,760)
    the procedure should delete all info reg. code 760
    and the table clients and also all the child records of this table
    perting to code 760.
    simply .. i need to delete from the table passed and also
    all the child tables down the heirarchy regarding certain code ...
    help ???
    Ravi Kumar M

    Hi,
    Depends how you defined referential integrity.
    You can use ON DELETE CASCADE, please read the next doc http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96540/clauses3a.htm#1002692
    Hope this help you,
    Nicolas.

  • I need to delete all my pictures off of my iPhone because I have run out of storage.  I have downloaded all pics to my mac but is my entire camera roll backed up on iCloud as well? I just want to make sure before I delete them from the phone.

    I need to delete all my photos off my iphone because I have run out of local storage.  I have synced with my Mac but also wanted online backup.  Are all my photos from the camera roll uploaded to iCloud?  I just want to make sure I can retrieve them after I erase from the phone and in case my Mac crashes.

    Import photos through iPhoto. (You will prompt to delete from iPhone when import competes).
    Backup your Mac. (At least the iPhoto Library)
    Backup to iTunes.
    Backup to iCloud. (Check in Settings>iCloud>Storage and Backup>Manage Storage>your device name>Camera Roll ON).

  • Need to delete account but support page wont work!

    Hi, I need to delete my account.
    I have typed this into help which tells me I need to contact Skype support however when I try to the page doesnt work so I cant contact them!
    Anyone know how to contact them by email? I've been trying to get on the right page for days but it just says "oops" and that its down!

    try using another web browser to open the Skype webform page, or perhaps another computer if available.  If still that doesn't work, you can also try to send an email to [email protected]  Yet, contacting Skype via webform/support page usually results to quicker responses as it have some sort of email filtering system based on the categories that a user will select (or something like that).
    IF YOU FOUND OUR POST USEFUL THEN PLEASE GIVE "KUDOS". IF IT HELPED TO FIX YOUR ISSUE PLEASE MARK IT AS A "SOLUTION" TO HELP OTHERS. THANKS!
    ALTERNATIVE SKYPE DOWNLOAD LINKS | HOW TO RECORD SKYPE VIDEO CALLS | HOW TO HANDLE SUSPICIOS CALLS AND MESSAGES

  • ESSO delete local cache in Citrix Server

    Hi all,
    I would to know when configuring the ESSO in the Citrix server, why do I need to enable the "Delete local cache"? Any problem if I disallow to delete local cache in the Citrix server?
    Thanks

    it has to do with the citrix server being a shared system. You should also be enabling an option to store local cache in memory only as well. I'm not sure as to the exact reason, but I do know it doesn't seem to function properly when those settings are not set as recommended.

  • Keep getting a popup window stating" startup disc almost full, need to delete files"

    keep getting a popup window stating" startup disc almost full, need to delete files", what can i do to help with this, i generally have only photos in iphoto, some imovies, and a small amount of documents

    You should never, EVER let a conputer hard drive get completely full, EVER!
    With Macs and OS X, you shouldn't let the hard drive get below 15 GBs or less of free data space.
    If it does, it's time for some hard drive housecleaning.
    Follow some of my tips for cleaning out, deleting and archiving data from your Mac's internal hard drive.
    Have you emptied your iMac's Trash icon in the Dock?
    If you use iPhoto, iPhoto has its own trash that needs to be emptied, also.
    If you store images in other locations other than iPhoto, then you will have to weed through these to determine what to archive and what to delete.
    If you use Apple Mail app, Apple Mail also has its own trash area that needs to be emptied, too!
    Delete any old or no longer needed emails and/or archive to disc, flash drives or external hard drive, older emails you want to save.
    Look through your other Mailboxes and other Mail categories to see If there is other mail you can archive and/or delete.
    Other things you can do to gain space.
    Once you have around 15 GBs regained, do a search, download and install OmniDisk Sweeper.
    This app will help you locate files that you can move/archive and/or delete from your system.
    STAY AWAY FROM DELETING ANY FILES FROM OS X SYSTEM FOLDER!
    Look through your Documents folder and delete any type of old useless type files like "Read Me" type files.
    Again, archive to disc, flash drives, ext. hard drives or delete any old documents you no longer use or immediately need.
    Look in your Applications folder, if you have applications you haven't used in a long time, if the app doesn't have a dedicated uninstaller, then you can simply drag it into the OS X Trash icon. IF the application has an uninstaller app, then use it to completely delete the app from your Mac.
    Download an app called OnyX for your version of OS X.
    When you install and launch it, let it do its initial automatic tests, then go to the cleaning and maintenance tabs and run the maintenance tabs that let OnyX clean out all web browser cache files, web browser histories, system cache files, delete old error log files.
    Typically, iTunes and iPhoto libraries are the biggest users of HD space.
    move these files/data off of your internal drive to the external hard drive and deleted off of the internal hard drive.
    If you have any other large folders of personal data or projects, these should be archived or moved, also, to the optical discs, flash drives or external hard drive and then either archived to disc and/or deleted off your internal hard drive.
    Good Luck!

Maybe you are looking for

  • Soundbooth cs4 will not launch in wondows 7

    I have been using CS4 production premium since the end of February. At that time I opened Soundbooth several times just to take look and  learn the landscape. That was several months ago. I am now at the point where I would like to learn Soundbooth a

  • Quick Time Icon

    Hi! I'm operating under Windows XP and I downloaded the latest version of the software. I'm just wondering if there's a way, under Windows Explorer, I could browse an image of my QT video instead of seeing the typical white and blue logo with "MOVIE"

  • Does anyone use a Time Capsule with Time machine to backup Logic?

    Just wondering if it works for big audio files?

  • Can a macbook pro retina display be replaced or fixed?

    Much to my horror, my 13 macbook pro retina has suffered a minor but noticable scratch to the display.  I'm wondering if anybody knows if this can be repaired or possible can the glass be replaced eventually?  Thanks in advance!     

  • How to repair DNS hostname?

    Hello, I had a working DNS setup with the right Primary address, Current HostName and DNS hostname. While figuring out how to use the Print service my DNS hostname changed. I suspect that when I was adding a printer IP to the DNS list something went