About JObject

Hi All
I am using PL/SQL web service. PL/SQL procedure receives primary key and on the basis of PK, it select values in different parameters. The parameters are defined as out.
When I import it in Oracle form, it generates function
FUNCTION custSelc(
obj ORA_JAVA.JOBJECT,
a0 ORA_JAVA.JOBJECT) RETURN ORA_JAVA.JOBJECT IS
BEGIN
args := JNI.CREATE_ARG_LIST(1);
JNI.ADD_OBJECT_ARG(args, a0, 'java/math/BigDecimal');
RETURN JNI.CALL_OBJECT_METHOD(FALSE, obj, 'mypackage1/MyWebService1Stub', 'custSelc', '(Ljava/math/BigDecimal;)Lcustomer_all/Customer_allImpl_custSelc_Out1;', args);
END;
I dont know how to get column values form ORA_JAVA.JOBJECT??
I have to display the values in specific fields in Oracle forms.

Hi bschauwe,
I have seen the documents, but I cannot find any related context of CallObjectMethod and how to return a java array object (jobjectArray??) Below is my code.
Java <code>
,//Class Image
public class Image{
     private int myWidth;
     private int myHeight;
     private int[][] myData;
     public Image(int width, int height){
          myWidth = width;
          myHeight = height;
          myData = new int [width][height];
          for (int i = 0; i < width; i++){
     for (int j = 0; j < height; j++){
     myData[i][j] = 10;
     public int getWidth() {return myWidth;}
     public int getHeight() {return myHeight;}
     public int[][] getData() {return myData;}
//End of Class Image
//Class AccessImage
class AccessImage {
private native void measureImage(Image img);
public static void main(String args[])
AccessImage p = new AccessImage();
Image img = new Image(40, 40);
p.measureImage(img);
//End of class AccessImage
//JNI code
#include <stdio.h>
#include <jni.h>
#include "AccessImage.h"
JNIEXPORT void JNICALL Java_AccessImage_measureImage(JNIEnv *env, jobject obj, jobject img)
jobjectArray Data;
jobject thd = img;
jclass cls = (*env)->FindClass(env, "Image");
jmethodID mid3 = (*env)->GetMethodID(env, cls, "getData", "()[[I");
Data = (*env)->CallObjectMethod(env, thd, mid3); //Errors happened here
</code>
Since I'm a newbie of JNI, please help me out. My purpose is to access the 2D integer array in class Image method getData(). Thanks a lot!

Similar Messages

  • An old and difficult problem about "UnsatisfiedLinkError"

    Hi dear all,
    I have been struck with the problem about "UnsatisfiedLinkError". I have a c++ class HelloWorld with a method hello(), and I want to call it from within a java class. In fact, I have succeeded in calling it on the windows platform. But when I transfer it to linux, the error "UnsatisfiedLinkError" comes out. I have tried to take the measures as Forum has suggested, but it failed.
    The source code is very simple to demonstrate JNI.
    "HelloWorld.h"
    #ifndef INCLUDEDHELLOWORLD_H
    #define INCLUDEDHELLOWORLD_H
    class HelloWorld
    public:
    void hello();
    #endif
    "HelloWorld.cpp"
    #include <iostream>
    #include "HelloWorld.h"
    using namespace std;
    void HelloWorld::hello()
    cout << "Hello, World!" << endl;
    "JHelloWorld.java"
    public class JHelloWorld
    public native void hello();
    static
    System.loadLibrary("hellolib");
    public static void main(String[] argv)
    JHelloWorld hw = new JHelloWorld();
    hw.hello();
    "JHelloWorld.cpp"
    #include <iostream>
    #include <jni.h>
    #include "HelloWorld.h"
    #include "JHelloWorld.h"
    JNIEXPORT void JNICALL Java_JHelloWorld_hello (JNIEnv * env, jobject obj)
    HelloWorld hw;
    hw.hello();
    All the files are in the same directory and all the processes are under the dirctory:
    1. javac JHelloWorld.java
    2. javah -classpath . JHelloWorld
    3. g++ -c -I/usr/java/jdk1.3/include -I/usr/java/jdk1.3/include/linux JHelloWorld.cpp HelloWorld.cpp
    4. ld -shared -o hellolib.so *.o
    5. java -cp . -Djava.library.path=. JHelloWorld
    Exception in thread "main" java.lang.UnsatisfiedLinkError: no hellolib in java.library.path
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1349)
    at java.lang.Runtime.loadLibrary0(Runtime.java:749)
    at java.lang.System.loadLibrary(System.java:820)
    at JHelloWorld.<clinit>(JHelloWorld.java:7)
    Tried another measure:
    i) export LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH
    ii)java -cp . JHelloWorld
    The same error came out as above.
    I really don't know what is wrong with it.
    Would you like to help me as soon as possible?
    Thanks.
    Regards,
    Johnson

    Hi Fabio,
    Thanks a lot for your help.
    It is very kind of you.
    Regards,
    Johnson

  • About CallByteMethodA Function

    Hi you all:
    I have some problem about CallByteMethodA function.
    This is what my java code looks like:
    public void setDS_INFO_mac(byte[] mac) {
    for( int i = 0; i < mac.length; ++i ) {
    this.ds_info.mac[i] = mac;
    This is what my c code looks like:
    jobject objref;
    jclass cls = NULL;
    jfieldID fid = NULL;
    jmethodID mid = NULL;
    jbyte dsMac[6];
    jbyteArray returnArray = 0;
    /* code not pertaining to this question snipped. */
    mid = env->GetMethodID(cls, "setDS_INFO_mac", "([B)V" );
      for( int j = 0; j < 6; ++j ) {
          dsMac[j] = search_Info[i].ds_info.mac[j];
    returnArray = env->NewByteArray(6);
    if( returnArray != NULL ) {
    env->SetByteArrayRegion(returnArray, 0, 6, (jbyte*)dsMac);
    env->CallByteMethodA(objref, mid, (jvalue*)returnArray);
    env->DeleteLocalRef(returnArray);
    This is not working.
    and, some about run time exception as follows:
    Exception in thread "main" java.lang.NullPointerException
    at CFGINFO.setDS_INFO_mac(DSCIStructure.java:97)
    at DSCIJNInterface.dsc_EnumSearch(Native Method)
    at MainApp.searching(MainApp.java:105)
    at MainApp.main(MainApp.java:46)
    Any idea what I'm doing wrong?

    You are missing error checking code. Many calls to the JNI interface require that you check the method return value. Many calls also require that java exceptions must be checked for after the call.

  • Error message on Solaris about JNIEnv *env

    Hi,
    I have this line of code in my simple C++ implementation of the native method:
    JNIEXPORT void JNICALL Java_jipclinker_jipc_1ne_1command
    (JNIEnv *env, jobject obj , jstring command)
    const char str = (env)->GetStringUTFChars(env, command, 0);
    // the rest of the code
    when I compile it in Solaris 2.8 I get the following error message:
    In function `void Java_jipclinker_jipc_1ne_1command(struct JNIEnv_ *, class jobject *, class jstring *)':
    16: base operand of `->' is not a pointer
    Can I have peoples ideas about this please?
    Thanks,
    S.

    Try
    env->GetStringTUFChars....

  • Jobject.equals(jobject) not working properly

    Hi !
    I'm just playing with JNI. I'd like to implement observer pattern with JNI. Java code would register observers via native methods, so C++ should remember observers. Maybe this is not so useful, but I just wanted to implement it to learn more about JNI.
    Actually observer registration part is working fine. I have STL list where i store jobjects from "addNativeEventListener".
    1 interface NativeEventListener
    2 {
    3 public void handleEvent(int event);
    4 }
    5
    6 public class NativeEventProducer
    7 {
    8 public native void addNativeEventListener(NativeEventListener listener);
    9 public native void removeNativeEventListener(NativeEventListener listener);
    10 }
    I struggle with implementing "removeNativeEventListener". Here is my code:
    52 JNIEXPORT void JNICALL Java_NativeEventProducer_removeNativeEventListener
    53 (JNIEnv *env, jobject obj, jobject observer)
    54 {
    55 jmethodID equalsID = env->GetMethodID(env->FindClass("java/lang/Object"), "equals", "(Ljava/lang/Object;)Z");
    56
    57 // deregister observer
    58 list<jobject>::iterator it = observers.begin();
    59 while (it != observers.end()) {
    60 if (env->CallBooleanMethod(observer, equalsID, *it)) {
    61 printf("equals\n");
    62 observers.erase(it++);
    63 } else {
    64 printf("not equals\n");
    65 it++;
    66 }
    67 }
    68 }
    And my Java main code:
    30 NativeEventProducer producer = new NativeEventProducer();
    31
    32 NativeEventListener listener1 = new NativeEventListenerImpl(1);
    33 NativeEventListener listener2 = new NativeEventListenerImpl(2);
    34 NativeEventListener listener3 = new NativeEventListenerImpl(3);
    35
    36 producer.addNativeEventListener(listener1);
    37 System.out.println("----");
    38 producer.addNativeEventListener(listener2);
    39 System.out.println("----");
    40 producer.addNativeEventListener(listener3);
    41 System.out.println("----");
    42 producer.removeNativeEventListener(listener2);
    After line 40, In my C++ "observers" list I have 3 jobjects. I can emit events using them. But ! In line 42, all observers are deregistered. "removeNativeEventListener" is native method (implementation above) env->CallBooleanMethod(observer, equalsID, *it) always returns "true".
    Any ideas appreciated ! ;)

    I think I was wrong. I made some more testing and I think that the problem i with inserting jobjects to list on c++ side. I implement is this way:
    37 JNIEXPORT void JNICALL Java_NativeEventProducer_addNativeEventListener
    38 (JNIEnv *env, jobject obj, jobject observer)
    39 {
    40 // register new observer
    41 observers.push_back(observer);
    42 }
    It looks like jobjects are reseted outside of my code. Is it possible ? I will try to copy jobject, maybe it'll help

  • Information about jni.h

    Hi,
    I want to know about the JNI functions that are being used in the native code , eg c or c++ .
    Take the example of the function GetObjectClass. Now this has been defined in jni.h as
    jclass GetObjectClass(jobject obj) {
    return functions->GetObjectClass(this,obj);
    where functions is defined in struct JavaVM_ as
    const struct JNIInvokeInterface_ *functions;
    Now when I look into struct JNIInvokeInterface_ there is no mention of the GetObjectClass. Then where does this function come from. Is it here in libjvm.so or what?
    Please explain me the same.
    Thanks and Regards,
    Anand

    In general I would say that the JNI functions "bottom out" in some native code inside the JVM. That native code may, in fact, ultimately call up to something in a jar, but it may not.
    Regarding your example: one way you could check this is to take a look at the java source code, and find out if Object.getClass is entirely implemented in java, or calls a native implementation function.

  • About the bar code report in printer server

    Hi:
    I have a question about the bar code report in printer server, i can do the bar code report in my local computer ,
    but it can't be work when put it into the printer server ,
    It would be get the error message :
    REP-110: can't open the file 'null'.
    REP-1070: it have a error when it open or sqve the document.
    REP-0110: can't open the file 'null'.
    I had study the document orbr_barcode.pdf before,
    and I do something below:
    1. copy a new oraclebarcode.jar into my computer.
    2. change the regedit HKEY_LOCAL_MACHINE\SOFTWARE\ORACLEHOME1\REPORTS_CLASSPATH,
    add a new path that the oraclebarcode.jar was.
    3. import java class
    oracle.apps.barcode.util.BarCodeConstant
    oracle.apps.barcode.BarCodeMaker
    4. new PACKAGE globals IS
    bcobj ora_java.jobject;
    barcode_to_use varchar(256);
    tempdir varchar(100);
    directory_sep varchar(2);
    END;
    5.modify function BeforeReport return boolean is
    begin
    globals.barcode_to_use := BarCodeConstants.BAR_CODE_39;
    globals.bcobj := barcodemaker.new();
    return (TRUE);
    end;
    6. new Formula in the DataModel, and set to image,
    function CF_barCodeFormula return VARCHAR2 is
    myfilename varchar2(500);
    result varchar2(500);
    barcodeData VarChar2(500) := :ast_no;
    begin
    myFileName := srw.create_temporary_filename;
    barcodemaker.setBarWidthInch(globals.bcobj,0.005);
    barcodemaker.setBaseCodeData(globals.bcobj,barcodeData);
    barcodemaker.setBarCodeType(globals.bcobj,globals.barcode_to_use);
    myFileName := barcodeData;
    barcodemaker.setFullPath(globals.bcobj, myFileName);
    barcodemaker.renderBarCode(globals.bcobj);
    return(myfilename);
    end;
    It's success when I build a bar code report in local computer,
    but I copy the oraclebarcode.jar into printer server and chage the HKEY_LOCAL_MACHINE\SOFTWARE\ORACLEHOME1\REPORTS_CLASSPATH, but it get the error message ...
    Please help me , I try it so many times and it still fail,
    your sincerely ,
    Hsiu-Chen, Yeh

    Dear Ph.
    sorry ...
    I can understand your command : the engine element in the server config file.
    can you Please explain this command more detail to me, Please.
    I deeply appreciated your kindness.
    Hsiu-chen, Yeh

  • Adobe Bridge in Photoshop - How to install Bridge and camera raw? And what is it all about?

    Hi everyone! I am actually in love with this adobe photoshop. I used PSCS2 before, but later on upgraded to CS4. But I feel tired in upgrading to CS5.
    One time, I found a tutorial in youtube about camera raw, and would really want to use it. But I was wondering how to install the camera raw. I believe camera raw is a plugin? so I downloaded the plugin here, installed it in my PS. I downloaded a file Camera Raw.8bi and paste it on my C drive - C:\Program Files\Adobe\Photoshop CS4\Plug-ins\File Formats.
    I now am very confused, how will I open it? I do not have adobe bridge!  After I installed the camera raw, I opened my PS. I clicked the file>then browse in bridge. I had an error, it's "error 2 photoshop11 undefined". Which is what I thought, I might have done something wrong with installing it.
    My question is, do you still need adobe bridge installed in order to use camera raw?
    If yes, how does it work? How am I suppose to open camera raw?
    If no, how am I going to open camera raw without bridge?
    And also, where will I download adobe bridge? I cannot find one here for CS4, only adobe bridge for CS5. I am wondering, is it okay to install adobe bridge CS5 and use it with my PS CS4?
    I badly need help!

    WebDAV (Web-based Distributed Authoring and Versioning) is a set of extensions to HTTP/1.1.
    The main difference from FTP as far as I can see is that it allows you to edit documents on a remote web server.
    WebDAV was used by the Apple server - MobileMe but is not generally supported by hosting services.
    Using WebDAV you can mount a directory locally. This was how iDisk worked on your Mac and you could drag files onto it to upload them to the remote directory.
    With WebDAV, a number of users can share a directory which is why its used in local networks but presents security problems when using a remote server.
    If you are into file sharing rather than publishing, Dropbox or its new rival SugarSync are more appropriate.

  • A few days ago i bought the macbook pro in a Providence. In late Summer i will come back to my Country - Ukraine. I would like to know about a tax for my laptop. Can i return tax? Through the TAX FREE or return in airport? What should i do?

    A few days ago i bought the macbook pro in a Providence. In late Summer i will come back to my Country - Ukraine. I would like to know about a tax for my
    laptop. Can i return tax? Through the TAX FREE or return in airport? What should i do?

    You need to talk with the tax authorities in the countries to which you traveled and that of your home country. We are all end-users liek you and not Apple agents.

  • I am trying to use itunes, it will not open at all, have uninstalled and downloaded new software and 64bit for windows. i have an old ipod nano from about 5 years ago. anything i can do, even to view my purchases and watch/listen to music etc?

    ok i have a advent roma laptop with window 7. my itunes used to work fine, completely. every time i plugged in my ipod it was ok. recently my ipod was not working so i never bothered with itunes, however i have movies/tv prog that i purchased and would like to view them. i have an ipod nano from about 5 years ago, the problem with thet is, it switches on, but the circular control panel does nothing, all you can do is lock and unlock it - nothing else.
    i tried to download new version of itunes, then uninstalled my origonal version, incase it was corrupted etc, i then again tried to down load new version and also version that is windows 64bit. still when i select the downlaod to open as son as it is finnished nothing happens. and now my desktop shortcut has dissapeared. before when it was there, id double click it, nothing, right click to open it, nothing.
    im not the best technically minded but i just dont see what im doing wrong here, please help

    Perhaps it would be helpful for you to view the page source code of this page
    http://www.alanwork.com/
    As you can see, the submenu code links are immediately below the top level code, and are
    wrapped in their own  <UL> </UL> tag pairs.
    Hope that helps

  • Vendor payments and debts about an asset

    Dear sap colleages
    I need to know these information about an ASSET:
    Purchased orders,
    Items from purchase orders,
    which of these items i've received, i've paid (also date), i've not paid ( amount of debt related to asset)
    payments in advanced (date),
    wich of these payments have been cleared (clearing date) and wich not,
    who is the vendor,
    other expenses (such as delivery)
    the amount of taxes,
    invoices related and NOT RELATED TO purchase order
    payments without invoice
    Which transactions do i need to follow?
    or
    Which document flow?
    or
    Which tables? Wich keys?
    or
    Is there a standard report that can give me such information?
    Any documentation and/or code will be appreciated.
    I need to program a report to integrate all these information.
    Thanks and Kind Regards

    Hi,
    Refer to T.code AW01N - Asset Explorer .
    Additionally you cna also refer to SAP Standard reports in Asset Accounting
    Accounting - Financial Accounting - Fixed Assets - Information System - Reports on Asset Accounting
    Please let me know if you need more information.
    Assign points if useful.
    Regards
    Sridhar M

  • I cannot receive email properly now. When I open mail, it says that is downloading about 1,700 emails. At the very end, it gives me my newest ones. But this takes a long time. I've contacted the Internet service provider and verified all the right setting

    I cannot receive email properly on either my IPad or my IPhone. I have had them for over a year and they have always worked fine. Until three days ago, when they both started acting up. On the IPad, when I open mail, it says it is downloading about 1,700 emails. At the very end, which takes quite a while to get to, I finally get the most recent ones. The IPad is sending emails just fine.
    On my IPhone, when I open mail, it says it is downloading 100 emails, but it doesn't do that. And it gives me no new emails at all. The IPhone is sending email just fine.
    I have already deleted the email accounts on both devices and reinstalled them. I've contacted the Internet service provider and verified all the right settings. The Outlook email on my desktop is working perfectly.

    WMV is a heavily-compressed format/CODEC, and the processing time will depend on several factors:
    Your CPU, which is not that powerful in your case
    Your I/O sub-system, which is likely a single HDD on your laptop
    The source footage. What is your source footage?
    Any Effects added to that footage. Do you have any Effects?
    Each of those will have an impact on the time required.
    The trial has only one main limitation - the watermark. Now, there are some components, that have to be activated, but are not with the trial, but they would be evident with Import of your source footage, if it's an issue.
    Good luck,
    Hunt

  • I have had my IPAD2 for quite a while but haven't activated my cellular data for about a year.  I am now trying to activate and when I go to cellular data, turn it on and try to tap view account i just get a message that says "connection to server lost".

    I have had my IPAD2 for quite a while but haven't activated my cellular data for about a year.  I am now trying to activate and when I go to cellular data, turn it on and try to tap view account i just get a message that says "connection to server lost".  I could swear the last time I used cellular data you would see the signal in the upper left corner and I only see "no service" there, I am in a location where I know I should have service.  Is there something I should do to my IPAD?  I tried resetting, I tried clearing cookies and history in Safari (after reading a post n these discussions).  I don't know what to do next. My IOS version is 6.1.3.  I did go into Network from the general tab and I see it says "SIM not provisioned".    HELP and Thank you in advance.

    Hello Theresa818,
    Thank you for using Apple Support Communities!
    It sounds like the cellular data will not activate for some reason on the iPad.
    I found this article that will help you resolve this issue here, named iPad (Wi-Fi + Cellular Models): Troubleshooting a cellular data connection, found here http://support.apple.com/kb/TS4249
    Check for a carrier settings update.
    Update your iPad.
    Toggle the Cellular Data setting off and on under Settings > Cellular Data.
    Restart your iPad.
    Tap Settings > General > About. Locate the Carrier entry and make sure that your carrier is correct.
    If your SIM card has SIM PIN enabled, try turning it off: Tap Settings > Cellular Data > SIM PIN.
    Make sure you're in an area of good coverage. If the cellular data connection works in another area, contact your carrier to report the original affected area.
    Reset network settings: Tap Settings > General > Reset > Reset Network Settings.
    Restore the iPad as new.
    If none of the above steps resolves the issue, make an appointment at an Apple Retail Store, contact your carrier, or contact AppleCare to troubleshoot further.
    I know you may have done one or two of the steps here, so you can skip those.
    Take care,
    Sterling

  • Doubt about report FBL5N of screen field:Open items and Cleared items

    hi
    i know the report FBL5N is use DDF LDB and the report work flow is BSID->BKFP->BSEG
    but i don't know to differentiate Open Items and Cleared items in this report.
    Open items and Cleared items stand for a field flag in these table (BSID,BKFP,BSEG )? if true the field is?
    or they must be calc in program ? if true what about calc rules?
    waiting for help! thank you!

    Hi,
    Here is the difference in Open Items and Cleared Items.
    In FI first the document is Open (when it is posted) so the entry is made in table BSID. Once the document is cleared, it will move from BSID to BSAD. And for Cleared item you will see Clearing Document no and Clearing date values updated (these are blank when the item is open).
    The only difference in Open and Cleared is via Clearing Document and Clearing Date. If the values are present, it means document is cleared.
    Hope this helps.
    ashish
    Message was edited by:
            Ashish Gundawar

  • Follow up on an old thread about memory utilization

    This thread was active a few months ago, unfortunately its taken me until now
    for me to have enough spare time to craft a response.
    From: SMTP%"[email protected]" 3-SEP-1996 16:52:00.72
    To: [email protected]
    CC:
    Subj: Re: memory utilization
    As a general rule, I would agree that memory utilzation problems tend to be
    developer-induced. I believe that is generally true for most development
    environments. However, this developer was having a little trouble finding
    out how NOT to induce them. After scouring the documentation for any
    references to object destructors, or clearing memory, or garbage collection,
    or freeing objects, or anything else we could think of, all we found was how
    to clear the rows from an Array object. We did find some reference to
    setting the object to NIL, but no indication that this was necessary for the
    memory to be freed.
    I believe the documentation, and probably some Tech-Notes, address the issue of
    freeing memory.
    Automatic memory management frees a memory object when no references to the
    memory
    object exist. Since references are the reason that a memory object lives,
    removing
    the references is the only way that memory objects can be freed. This is why the
    manuals and Tech-Notes talk about setting references to NIL (I.E. freeing memory
    in an automatic system is done by NILing references and not by calling freeing
    routines.) This is not an absolute requirement (as you have probably noticed
    that
    most things are freed even without setting references to NIL) but it accelerates
    the freeing of 'dead' objects and reduces the memory utilization because it
    tends
    to carry around less 'dead' objects.
    It is my understanding that in this environment, the development tool
    (Forte') claims to handle memory utilization and garbage collection for you.
    If that is the case, then it is my opinion that it shoud be nearly
    impossible for the developer to create memory-leakage problems without going
    outside the tool and allocating the memory directly. If that is not the
    case, then we should have destructor methods available to us so that we can
    handle them correctly. I know when I am finished with an object, and I
    would have no problem calling a "destroy" or "cleanup" method. In fact, I
    would prefer that to just wondering if Forte' will take care of it for me.
    It is actually quite easy to create memory leaks. Here are some examples:
    Have a heap attribute in a service object. Keep inserting things into
    the heap and never take them out (I.E. forgot to take them out). Since
    service objects are always live, everything in the heap is also live.
    Have an exception handler that catches exceptions and doesn't do
    anything
    with the error manager stack (I.E. it doesn't call task.ErrMgr.Clear).
    If the handler is activated repeatedly in the same task, the stack of
    exceptions will grow until you run out of memory or the task terminates
    (task termination empties the error manager stack.)
    It seems to me that this is a weakness in the tool that should be addressed.
    Does anyone else have any opinions on this subject?
    Actually, the implementation of the advanced features supported by the Forte
    product
    results in some complications in areas that can be hard to explain. Memory
    management
    happens to be one of the areas most effected. A precise explanation to a
    non-deterministic process is not possible, but the following attempts to
    explain the
    source of the non-determinism.
    o The ability to call from compiled C++ to interpreted TOOL and back
    to compiled C++.
    This single ability causes most of the strange effects mentioned in
    this thread.
    For C++ code the location of all variables local to a method is not
    know
    (I.E. C++ compilers can't tell you at run-time what is a variable
    and what
    isn't.) We use the pessimistic assumption that anything that looks
    like a
    reference to a memory object is a reference to a memory object. For
    interpreted
    TOOL code the interpreter has exact knowledge of what is a reference
    and what
    isn't. But the TOOL interpreter is itself a C++ method. This means
    that any
    any memory objects referenced by the interpreter during the
    execution of TOOL
    code could be stored in local variables in the interpreter. The TOOL
    interpreter
    runs until the TOOL code returns or the TOOL code calls into C++.
    This means
    that many levels of nested TOOL code can be the source of values
    assigned to
    local variables in the TOOL interpreter.
    This is the complicated reason that answers the question: Why doesn't a
    variable that is created and only used in a TOOL method that has
    returned
    get freed? It is likely that the variable is referenced by local
    variables
    in the TOOL interpreter method. This is also why setting the
    variable to NIL
    before returning doesn't seem to help. If the variable in question is a
    Array than invoke Clear() on the Array seems to help, because even
    though the
    Array is still live the objects referenced by the Array have less
    references.
    The other common occurrence of this effect is in a TextData that
    contains a
    large string. In this case, invoking SetAllocatedSize(0) can be used
    to NIL
    the reference to the memory object that actually holds the sequence of
    characters. Compositions of Arrays and TextData's (I.E. a Array of
    TextData's
    that all have large TextDatas.) can lead to even more problems.
    When the TOOL code is turned into a compiled partition this effect
    is not
    noticed because the TOOL interpreter doesn't come into play and
    things execute
    the way most people expect. This is one area that we try to improve
    upon, but it is complicated by the 15 different platforms, and thus
    C++ compilers,
    that we support. Changes that work on some machines behave
    differently on other
    machines. At this point in time, it occasionally still requires that
    a TOOL
    programmer actively address problems. Obviously we try to reduce
    this need over
    time.
    o Automatic memory management for C++ with support for multi-processor
    threads.
    Supporting automatic memory management for C++ is something that is
    not a very
    common feature. It requires a coding standard that defines what is
    acceptable and
    what isn't. Additionally, supporting multi-processor threads adds
    its own set of
    complications. Luckily TOOL users are insulated from this because
    the TOOL to C++
    code generator knows the coding standard. In the end you are
    impacted by the C++
    compiler and possibly the differences that occur between different
    compilers and/or
    different processors (I.E. Intel X86 versus Alpha.) We have seen
    applications that
    had memory utilization differences of up to 2:1.
    There are two primary sources of differences.
    The first source is how compilers deal with dead assignments. The
    typical TOOL
    fragment that is being memory manager friendly might perform the
    following:
    temp : SomeObject = new;
    ... // Use someObject
    temp = NIL;
    return;
    When this is translated to C++ it looks very similar in that temp
    will be assigned the
    value NULL. Most compilers are smart enough to notice that 'temp' is
    never used again
    because the method is going to return immediately. So they skip
    setting 'temp' to NULL.
    In this case it should be harmless that the statement was ignored
    (see next example for a different variation.) In more
    complicated examples that involve loops (especially long
    lived event loops) a missed NIL assignment can lead to leaking the
    memory object whose
    reference didn't get set to NIL (incidentally this is the type of
    problem that causes
    the TOOL interpreter to leak references.)
    The second source is a complicated interaction caused by history of
    method invocations.
    Consider the following:
    Method A() invokes method B() which invokes method C().
    Method C() allocates a temporary TextData, invokes
    SetAllocatedSize(1000000)
    does some more work and then returns.
    Method B() returns.
    Method A() now invokes method D().
    Method D() allocates something that cause the memory manager to look
    for memory objects to free.
    Now, even though we have returned out of method C() we have starting
    invoking
    methods. This causes us to use re-use portions of the C++ stack used to
    maintain the history of method invocation and space for local variables.
    There is some probability that the reference to the 'temporary' TextData
    will now be visible to the memory manager because it was not overwritten
    by the invocation of D() or anything invoked by method D().
    This example answers questions of the form: Why does setting a local
    variable to
    NIL and returning and then invoking task.Part.Os.RecoverMemory not
    cause the
    object referenced by the local variable to be freed?
    In most cases these effects cause memory utilization to be slightly
    higher
    than expected (in well behaved cases it's less than 5%.) This is a small
    price to pay for the advantages of automatic memory management.
    An object-oriented programming style supported by automatic memory
    management makes it
    easy to extended existing objects or sets of objects by composition.
    For example:
    Method A() calls method B() to get the next record from the
    database. Method B()
    is used because we always get records, objects, of a certain
    type from
    method B() so that we can reuse code.
    Method A() enters each row into a hash table so that it can
    implement a cache
    of the last N records seen.
    Method A() returns the record to its caller.
    With manual memory management there would have to be some interface
    that allows
    Method A() and/or the caller of A() to free the record. This
    requires
    that the programmer have a lot more knowledge about the
    various projects
    and classes that make up the application. If freeing doesn'
    happen you
    have a memory leak, if you free something while its still
    being used the
    results are unpredictable and most often fatal.
    With automatic memory management, method A() can 'free' its
    reference by removing
    the reference from the hash table. The caller can 'free' its
    reference by
    either setting the reference to NIL or getting another
    record and referring
    to the new record instead of the old record.
    Unfortunately, this convenience and power doesn't come for free. Consider
    the following,
    which comes from the Forte' run-time system:
    A Window-class object is a very complex beast. It is composed of two
    primary parts:
    the UserWindow object which contains the variables declared by the
    user, and the
    Window object which contains the object representation of the window
    created in
    the window workshop. The UserWindow and the Window reference each
    other. The Window
    references the Menu and each Widget placed on the Window directly. A
    compound Window
    object, like a Panel, can also have objects place in itself. These
    are typically
    called the children. Each of the children also has to know the
    identity of it's
    Mom so they refer to there parent object. It should be reasonably
    obvious that
    starting from any object that make up the window any other object
    can be found.
    This means that if the memory manager finds a reference to any
    object in the Window
    it can also find all other objects in the window. Now if a reference
    to any object
    in the Window can be found on the program stack, all objects in the
    window can
    also be found. Since there are so many objects and the work involved
    in displaying
    a window can be very complicated (I.E. the automatic geometry
    management that
    layouts the window when it is first opened or resized.) there are
    potentially many
    different reference that would cause the same problem. This leads to
    a higher than
    normal probability that a reference exists that can cause the whole
    set of Window
    objects to not be freed.
    We solved this problem in the following fashion:
    Added a new Method called RecycleMemory() on UserWindow.
    Documented that when a window is not going to be used again
    that it is
    preferably that RecycleMemory() is invoked instead
    of Close().
    The RecycleMemory() method basically sets all references
    from parent to
    child to NIL and sets all references from child to
    parent to NIL.
    Thus all objects are isolated from other objects
    that make up
    the window.
    Changed a few methods on UserWindow, like Open(), to check
    if the caller
    is trying to open a recycled window and throw an
    exception.
    This was feasible because the code to traverse the parent/child
    relationship
    ready existed and was being used at close time to perform other
    bookkeeping
    operations on each of the Widgets.
    To summarize:
    Automatic memory management is less error prone and more productive but
    doesn't come totally for free.
    There are things that the programmer can do that assists the memory
    manager:
    o Set object reference to NIL when known to be correct (this
    is the
    way the memory is deallocated in an automatic system.)
    o Use methods like Clear() on Array and SetAllocatedSize()
    on TextData to
    that allow these objects to set their internal
    references to NIL
    when known to be correct.
    o Use the RecycleMemory() method on windows, especially very
    complicated
    windows.
    o Build similar type of methods into your own objects when
    needed.
    o If you build highly connected structures that are very
    large in the
    number of object involved think that how it might be
    broken
    apart gracefully (it defeats some of the purpose of
    automatic
    management to go to great lengths to deal with the
    problem.)
    o Since program stacks are the source of the 'noise'
    references, try
    and do things with less tasks (this was one of the
    reasons that
    we implemented event handlers so that a single task
    can control
    many different windows.)
    Even after doing all this its easy to still have a problem.
    Internally we have
    access to special tools that can help point at the problem so that
    it can be
    solved. We are attempting to give users UNSUPPORTED access to these
    tools for
    Release 3. This should allow users to more easily diagnose problems.
    It also
    tends to enlighten one about how things are structured and/or point out
    inconsistencies that are the source of known/unknown bugs.
    Derek
    Derek Frankforth [email protected]
    Forte Software Inc. [email protected]
    1800 Harrison St. +510.869.3407
    Oakland CA, 94612

    I beleive he means to reformat it like a floppy disk.
    Go into My Computer, Locate the drive letter associated with your iPod(normally says iPod in it, and shows under removable storage).
    Right click on it and choose format - make sure to not have the "quick format" option checked. Then let it format.
    If that doesnt work, There are steps somewhere in the 5th gen forum( dont have the link off hand) to try to use the usbstor.sys to update the USB drivers for the Nano/5th gen.

Maybe you are looking for