Possible memory leak in C++ code

Hello,
I have a Java application that calls through JNI, functions in a C++ dll that use the GroupWise API (COM based). After the application creates a number of accounts in GroupWise the memory footprint of the java.exe process reaches ~1.5GB of RAM on a 32 bit Windows OS. After reaching this value, the C++ code no longer works, meaning that connecting to GroupWise fails. If I restart the application at this point everything starts to work until it reached ~1.5 GB again.
I am suspecting that the problem might be caused by a memory leak. I have taken a dump of the java process with jmap and analyzed it with jhat. If I have not released an object in C++ code, would this object be visible in the dump i took of the java.exe process? The biggest consumer from what i have seen in the dump is class [B      20353-instances      33259261-bytes.
Has anyone else tried to track a memory leak in a JNI application? How did you achive this task, what tools did you use?
Thank you,
Ionut Marin.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

Has anyone else tried to track a memory leak in a JNI application? How did you achive this task, what tools did you use?You write a library in C/C++ only which does NOT use JNI which implements the functionality you want to achieve in your java application.
You write a wrapper for that which excercises it completely including be able to run it in a loaded state.
Then you buy/find a C/C++ profiling tool and run it on the wrapper.
You write you JNI code such that the ONLY thing it does is interface between java and the library above. It doesn't impleent business logic nor work flow.

Similar Messages

  • Possible memory leaks in the code , ASSERT messages in debug version !!!

    Hi,
    I have my Indesign C++ plugin running successfully in DEBUG and RELEASE versions of Indesign.
    But in Debug version, when I close my Indesign, I get a series of ASSERTS which I am not able to figure out why.
    Below is the list of ASSERT I am getting while closing Indesign(loaded with my plugin)
    Still have un-registered listener
    ..\..\..\source\components\csxs\CSXSPlugPlug.cpp (562)
    ASSERT 'fInitialized' in ..\..\..\source\components\csxs\CSXSPlugPlug.cpp at line 1027 failed.
    ~InstanceList(): 2 outstanding references to UID 421 (Class kTextStoryBoss).
    ..\..\..\source\components\database3\main\InstanceList.cpp (1928)
    ~InstanceList(): 1 outstanding references to UID 443 (Class kSBOSMgrIndexStorageBoss).
    ..\..\..\source\components\database3\main\InstanceList.cpp (1928)
    ~InstanceList(): 1 outstanding references to UID 420 (Class kFrameListBoss).
    ..\..\..\source\components\database3\main\InstanceList.cpp (1928)
    ~InstanceList(): 5 outstanding references to UID 1 (Class ShuksanPrefix + 1 (0x101)).
    ..\..\..\source\components\database3\main\InstanceList.cpp (1928)
    28 Outstanding Bosses!(Check file :QA:Logs:OutstandingBossLog.txt)
    c:\development\citius\source\private\foundation\InterfaceTrackingUtils.cpp (107)
    What changes do I need to make in my code to avoid these ASSERTS and is this something I should worry about?

    I tried to follow the instructions by copying the text file and restarting Indesign but then it failed immidiately.
    I have use InterfacePtr every where to get the reference of the boss I dont understand how these Outstanding Boss classes are remaining in my code.

  • Memory Leaks in JNI code

    Hi,
    I have written a small C++ code which will load a JDBC Driver and connect to the database.
    The code initially Loads the JVM & than connects to the Database.
    When i tested the code with Boundscheket I found a conciderable amount of memory leak & all of these are shown in jvm.dll, zip.dll & java.dll. Is this OK? Are there memory leaks in JNI?

    Hi, Please go through the code & let me know if there are any memory leaks in this code. Boundchecker detects a considerable amount of memory leak :(
    #include <windows.h>
    #include <stdio.h>
    #include <jni.h>
    #include <conio.h>
    #define INI_MAX_PROPERTY_VALUE 1024
    #define JVMPATH "C:\\Java\\jdk1.5\\jre\\bin\\client\\jvm.dll"
    #define JDBCDRIVER "-Djava.class.path=D:\\mysql-connector-java.jar";
    #define CONNECTIONSTRING "jdbc:mysql://localhost:3306/test?user=root&password=root"
    #define DRIVERCLASS "com/mysql/jdbc/Driver"
    JavaVM *jvm = NULL;
    unsigned long int jvmVersion = 0x00010004;
    HINSTANCE lib_handle = NULL;
    void fini() {
         jint res = jvm->DestroyJavaVM();
         printf ("Destroying JVM %d\n",res);
         if (lib_handle) {
              FreeLibrary(lib_handle);
              printf ("Deleted lib handle\n");
    void init()
         char jvmPath[INI_MAX_PROPERTY_VALUE + 1];
         jint res = -1;
         JNIEnv *jniEnv = NULL;
         JavaVMInitArgs vm_args;
         JavaVMOption options[1];
         options[0].optionString = JDBCDRIVER;
         vm_args.version = jvmVersion;
    vm_args.options = options;
    vm_args.nOptions = 1;
    vm_args.ignoreUnrecognized = JNI_TRUE;
         memset(jvmPath, '\0', INI_MAX_PROPERTY_VALUE + 1);
         strcpy(jvmPath,JVMPATH);
         printf("Loading dll from %s\n",jvmPath);
         lib_handle = LoadLibrary(jvmPath);
         if (!lib_handle)
              printf("Error during LoadLibrary\n");
              return;
         printf("JVM dll Loaded Sucessfully\n");
         jint (__stdcall JNI_CreateJavaVM)( JavaVM*, void**, void*);
         JNI_CreateJavaVM = (jint (__stdcall *)(JavaVM**, void**, void*))GetProcAddress(lib_handle, "JNI_CreateJavaVM");
         if (NULL != JNI_CreateJavaVM)
              res = (JNI_CreateJavaVM)( &jvm, (void**)&jniEnv , &vm_args);
         if ( res < 0 ) {
              printf("Unable to create JVM\n");
         } else {
              printf("JVM Created Succesfully\n");
    void printException(JNIEnv *jniEnv) {
         jthrowable exceptionHandle = jniEnv->ExceptionOccurred();
         if ( exceptionHandle == NULL )
              return;
         /* Clear the exception from the enviroment*/
         jniEnv->ExceptionClear();
         /* Obtain the JavaException object to get its details */
         jclass jThrowableClass = jniEnv->GetObjectClass(exceptionHandle);
         if ( jThrowableClass == NULL ) {
              if (exceptionHandle)
                   jniEnv->DeleteLocalRef(exceptionHandle);     
              exceptionHandle = NULL;
              return ;
         printf("\n*****----- Java Error Message is -----*****\n");
         jmethodID midMessage = jniEnv->GetMethodID( jThrowableClass, "toString", "()Ljava/lang/String;" );
         if ( midMessage == NULL ){
              if (exceptionHandle)
                   jniEnv->DeleteLocalRef(exceptionHandle);
              if (jThrowableClass)
                   jniEnv->DeleteLocalRef(jThrowableClass);
              exceptionHandle = NULL;
              jThrowableClass = NULL;
              return;
         jstring jstrRet = (jstring)jniEnv->CallObjectMethod(exceptionHandle,midMessage);
         if ( jstrRet == NULL ){
              if (exceptionHandle)
                   jniEnv->DeleteLocalRef(exceptionHandle);
              if (jThrowableClass)
                   jniEnv->DeleteLocalRef(jThrowableClass);
              exceptionHandle = NULL;
              jThrowableClass = NULL;
              return;
         jboolean flg;
         const char *pExceptionStr = jniEnv->GetStringUTFChars(jstrRet, &flg);
         if ( flg == JNI_TRUE ) {
              printf("%s",pExceptionStr);
              jniEnv->ReleaseStringUTFChars(jstrRet, pExceptionStr);
         if (exceptionHandle)
              jniEnv->DeleteLocalRef(exceptionHandle);
         if (jThrowableClass)
              jniEnv->DeleteLocalRef(jThrowableClass);
         if (jstrRet)
              jniEnv->DeleteLocalRef(jstrRet);
         exceptionHandle = NULL;
         jThrowableClass = NULL;
         jstrRet = NULL;
         printf("\n**************---------End of Java Error Message ************\n");
         return;
    void connect() {
         jint res = -1;
         JNIEnv *jniEnv = NULL;
         jclass clsDriver = NULL;
         jmethodID colnstructorDriver = NULL;
         jmethodID methodConnect = NULL;
         jobject objectDriver = NULL;
         jobject objectConnection = NULL;
         jstring jConnectionString = NULL;
         printf("Getting the Enviroment\n");
         jint isPresent = jvm->GetEnv((void **)&jniEnv, jvmVersion );
         if (isPresent == JNI_EDETACHED || jniEnv == NULL) {
              printf("Could not get JNI Env for current thread");
    return;
         printf("Creating Instance of Driver\n");
         clsDriver = jniEnv->FindClass(DRIVERCLASS);
         colnstructorDriver = jniEnv->GetMethodID(clsDriver, "<init>", "()V");
         objectDriver = jniEnv->NewObject( clsDriver, colnstructorDriver );
         printf("Created Instance of Driver\n");
         printf("Connecting to the Database\n");
         methodConnect = jniEnv->GetMethodID(clsDriver, "connect", "(Ljava/lang/String;Ljava/util/Properties;)Ljava/sql/Connection;");
         jConnectionString = jniEnv->NewStringUTF(CONNECTIONSTRING);
         objectConnection = jniEnv->CallObjectMethod(objectDriver, methodConnect, jConnectionString, NULL);
         if (objectConnection == NULL) {
              printException(jniEnv);
              printf("Unable to Connect\n");
         else
              printf("Connection Done\n");
         //Releasing all the memory used....
         if (objectConnection)
              jniEnv->DeleteLocalRef(objectConnection);
         if (jConnectionString)
              jniEnv->DeleteLocalRef(jConnectionString);
         if (objectDriver)
              jniEnv->DeleteLocalRef(objectDriver);
         if (clsDriver)
              jniEnv->DeleteLocalRef(clsDriver);
         objectConnection = NULL;
         jConnectionString = NULL;
         objectDriver = NULL;
         clsDriver = NULL;
    int main() {
         printf ("Starting...\n");
         init();
         connect();
         fini();
         getch();
    }

  • Possible Memory Leak, many instances of macromedia.jdbc.oracle.OracleConnection, serviceFactory

    I'm using a plug-in for Eclipse to help identify possible memory leaks however we are having trouble interpreting the results.  The top, and pretty much the only, suspect is this...
    7,874 instances of "macromedia.jdbc.oracle.OracleConnection", loaded by "coldfusion.bootstrap.BootstrapClassLoader @ 0xf935218" occupy 604,781,904 (71.02%) bytes. These instances are referenced from one instance of "java.util.HashMap$Entry[]", loaded by "<system class loader>"
    Any ideas what could cause this many instances?  How do we track this back to a particular cfm or cfc?  Do these number seem high or is that normal?  The system in question normally only has 30-60 concurrent users.
    The one item I'm a little skeptical of is the use of the "coldfusion.server.ServiceFactory" and "coldfusion.sql.QueryTable" objects.  We use them for 1000s of different queries, even queries within large loops.  Could these be the problem?  Each time we need to execute a query we do a createObject for each of these objects, when done we close the connection.  I recently found a similar example where they close the recordSet first and then close the connection, we are not closing the recordSet.  Any help at all is much appreciated.

    It could simply be caused by the obvious: a query or queries making a large number of connections and/or consuming large resources on the Oracle database. Use Eclipse to search your application folder for queries. Can you identify any queries that could be the culprit? Is there a loop containing a method or an instance of a component that queries an Oracle database?
    What's your Coldfusion  version? If you're on CF8 or CF9 then the server monitor (in the Coldfusion Administrator) might tell you the process responsible for the high consumption.

  • Possible memory leak in TagFileTagInfo class

    Hello,
    Our application is experiencing a memory leak in Weblogic, which is not happening in other application servers.
    We are running Weblogic server 10.3 using the distributed jsf 1.2
    Eclipse Memory Analyzer clearly points to TagFileTagInfo class as retaining a Map which holds all the memory. Furthermore, it shows that said map (called _tagFileInfoMap) is holding FileTagFileInfo class instances.
    It could be possible that our application were doing something wrong, and that would cause the described behavior, however I doubt that as the other application servers where our application is deployed do not present this problem.
    Any suggestion on how we should proceed to fix this problem?
    Thanks
    Juan

    Hi,
    Was this issue resolved by using wlappc?
    Were you able to compile the tag files with wlappc? I tried compiling the jsps using wlappc, but it seems that the tool expects an ejb-jar file.
    Any help on this is greatly appreciated.
    Thanks
    Hareesh

  • Possible Memory Leak in WLS6.1-SP2

    Hello,
    I need your help in getting to the bottom of a memory issue we are facing.
    We are running EJB based applications on Web Logic Server (WLS) 6.1 SP2 on Solaris
    8 servers using 1.3.1_03 JDK. There are several applications running, but lets
    use one of them as example.
    I am using the following JDK parameters:
    -XX:NewSize=96m -XX:MaxNewSize=96m -Xms384m -Xmx384m -XX:SurvivorRatio=2
    The memory values on Solaris, before the application is started, are as follows:
    Real memory = 4096M, Free memory = 2415M, Swap in use = 1059M, Swap free = 2322M
    When I start the applications, I can see the memory foot print for this application
    at around 540 Meg. Since JVM pre-allocates heap space, I expect this number to
    remain constant as the application is stressed. But this does not happen, and
    it puzzles me. I see the memory footprint of application go up, and that makes
    me believe that is a memory leak somewhere. Since heap space remains below the
    selected limit (384M), and the application does not over-run heap, it makes me
    believe that the memory leak is not happening in application code; rather it is
    Web Logic Server that is leaking memory.
    As the application runs, the memory footprint increase from 540M to almost 900M,
    to the point the system is left with very low free swap space, and the application
    (not necessarily this particular one) starts throwing OutOfMemoryError.
    At this point, it becomes impossible to recover and the only way out is to bounce
    WLS.
    Does it sound like a memory leak issue to you ? Do you agree that it look like
    a WLS memory leak?
    If anybody had similar experience, please help me with your advice. I would be
    very interested in knowing how you diagnosed the problem and what solution did
    you apply.
    Thanks,
    Asad Faizi

    The native OCI driver is not allocating out of the Java heap, but rather
    from the OS (or the c rtl) so the Java heap parameters do not affect it. I
    don't know if it is a problem that you see or just normal behavior.
    Peace,
    Cameron Purdy
    Tangosol, Inc.
    http://www.tangosol.com/coherence.jsp
    Tangosol Coherence: Clustered Replicated Cache for Weblogic
    "Asad Faizi" <[email protected]> wrote in message
    news:[email protected]...
    >
    Cameron,
    We are using Oracle-8.1.7r3 driver. Can you give me some more informationas to
    why do you suspect Oracle JDBC driver? Have you had similar experience ?How did
    you diagnose this and what did you do to fix it?
    Thanks,
    Asad Faizi
    "Cameron Purdy" <[email protected]> wrote:
    Probably a JDBC driver (Oracle OCI?).
    Peace,
    Cameron Purdy
    Tangosol, Inc.
    http://www.tangosol.com/coherence.jsp
    Tangosol Coherence: Clustered Replicated Cache for Weblogic
    "Asad Faizi" <[email protected]> wrote in message
    news:[email protected]...
    Hello,
    I need your help in getting to the bottom of a memory issue we arefacing.
    We are running EJB based applications on Web Logic Server (WLS) 6.1SP2 on
    Solaris
    8 servers using 1.3.1_03 JDK. There are several applications running,but
    lets
    use one of them as example.
    I am using the following JDK parameters:
    -XX:NewSize=96m -XX:MaxNewSize=96m -Xms384m -Xmx384m -XX:SurvivorRatio=2
    The memory values on Solaris, before the application is started, areas
    follows:
    Real memory = 4096M, Free memory = 2415M, Swap in use = 1059M, Swapfree =
    2322M
    When I start the applications, I can see the memory foot print forthis
    application
    at around 540 Meg. Since JVM pre-allocates heap space, I expect thisnumber to
    remain constant as the application is stressed. But this does not
    happen,
    and
    it puzzles me. I see the memory footprint of application go up, andthat
    makes
    me believe that is a memory leak somewhere. Since heap space remainsbelow
    the
    selected limit (384M), and the application does not over-run heap,it
    makes me
    believe that the memory leak is not happening in application code;rather
    it is
    Web Logic Server that is leaking memory.
    As the application runs, the memory footprint increase from 540M toalmost
    900M,
    to the point the system is left with very low free swap space, andthe
    application
    (not necessarily this particular one) starts throwing OutOfMemoryError.
    At this point, it becomes impossible to recover and the only way outis to
    bounce
    WLS.
    Does it sound like a memory leak issue to you ? Do you agree that itlook
    like
    a WLS memory leak?
    If anybody had similar experience, please help me with your advice.I
    would be
    very interested in knowing how you diagnosed the problem and what
    solution
    did
    you apply.
    Thanks,
    Asad Faizi

  • Possible Memory Leak in C-API

    I can start my C_API JMS application and just create a JMS context. Looking at the windows task manager I see the memory footprint slowly grow.
    I'm not a Java wizard so I haven't found the right tools set for diagnosing this.
    Thanks for any help

    Has anyone else tried to track a memory leak in a JNI application? How did you achive this task, what tools did you use?You write a library in C/C++ only which does NOT use JNI which implements the functionality you want to achieve in your java application.
    You write a wrapper for that which excercises it completely including be able to run it in a loaded state.
    Then you buy/find a C/C++ profiling tool and run it on the wrapper.
    You write you JNI code such that the ONLY thing it does is interface between java and the library above. It doesn't impleent business logic nor work flow.

  • OCIServerAttach possible memory leak

    Hi
    For the last day I'm stuck in this case...and I'm pretty sure it is a memory leak:
    I have a multithreaded application, in C++. First I create a threaded environment (OCIEnvCreate in OCI_THREADED mode) in the main application thread. Next i start multiple threads, and in each one I open a new session to the Oracle database, using OCIServerAttach and next OCIBeginSession.
    I'm testing the case when the threads keep failing and they are restarted. For the tests I use an invalid schema (a dummy name that's not present in tnsnames.ora) when calling OCIServerAttach. In this case the statement fails and I call OCIServerDetach, which it should release the memory allocated in OCIServerAttach, but it seems that it doesn't do that...I watched the application with a memory leak detection tool and i keep getting memory leaks in OCIServerAttach....
    I read about this exact problem in some older Oracle releases, 8i. Now I'm using Oracle 9.2 with 9.2.0.4 patch installed.
    Please help me with any idea, cause i'm getting desperate...
    marius

    exactly :) it doesn't seem like it has leaks :) but...
    i made a test where i restarted 4 threads about 2000 - 3000 times (each time executing OCIServerAttach - OCIServerDetach)...and i got about 400 leaks. it's not for each thread...i don't get it
    here is the code:
    - open a new session:
    bool CORCLSession::beginSession(IN OCIEnv* phEnv,
                                            IN const char* pszConnectString)
         if (true == m_fConnected)
              endSession();
         m_phEnv = phEnv;
         strcpy(m_szConnectString, pszConnectString);
         char szUserName[MAX_CONNECT_STRING];
         char szPassword[MAX_CONNECT_STRING];
         char szSchema[MAX_CONNECT_STRING];
         splitConnectString(m_szConnectString, szUserName, szPassword, szSchema);
         /* allocate an error handle */
         m_nRetCode = OCIHandleAlloc((dvoid *)m_phEnv,
                                            (dvoid **)&m_phError,
                                            OCI_HTYPE_ERROR, 0, (dvoid **) 0);
         handleRetCode(CORCLException::OSES_BEGINSESSION);
         /* allocate a server handle */
         m_nRetCode = OCIHandleAlloc ((dvoid *)m_phEnv, (dvoid **)&m_phServer,
                             OCI_HTYPE_SERVER, 0, (dvoid **) 0);     
         handleRetCode(CORCLException::OSES_BEGINSESSION);
         /* create a server context */
         m_nRetCode = OCIServerAttach (m_phServer, m_phError,
                                            (text *)szSchema, strlen(szSchema),
                                            OCI_DEFAULT);
         handleRetCode(CORCLException::OSES_BEGINSESSION);
         m_fAttach = true;
         /* allocate a service handle */
         m_nRetCode = OCIHandleAlloc((dvoid *)m_phEnv,
                                            (dvoid **)&m_phSvcCtx,
                                            OCI_HTYPE_SVCCTX, 0, (dvoid **) 0);
         handleRetCode(CORCLException::OSES_BEGINSESSION);
         /* set the server attribute in the service context handle*/
         m_nRetCode = OCIAttrSet((dvoid *)m_phSvcCtx, OCI_HTYPE_SVCCTX,
                                       (dvoid *)m_phServer,
                                       (ub4) 0, OCI_ATTR_SERVER, m_phError);
         handleRetCode(CORCLException::OSES_BEGINSESSION);
         /* allocate a user session handle */
         m_nRetCode = OCIHandleAlloc((dvoid *)m_phEnv,
                                            (dvoid **)&m_phUserSession,
                                            OCI_HTYPE_SESSION, 0, (dvoid **) 0);
         handleRetCode(CORCLException::OSES_BEGINSESSION);
         /* set username attribute in user session handle */
         m_nRetCode = OCIAttrSet((dvoid *)m_phUserSession, OCI_HTYPE_SESSION,
                                       (dvoid *)szUserName, (ub4)strlen(szUserName),
                                       OCI_ATTR_USERNAME, m_phError);
         handleRetCode(CORCLException::OSES_BEGINSESSION);
         /* set password attribute in user session handle */
         m_nRetCode = OCIAttrSet((dvoid *)m_phUserSession, OCI_HTYPE_SESSION,
                                       (dvoid *)szPassword, (ub4)strlen(szPassword),
                                       OCI_ATTR_PASSWORD, m_phError);
         handleRetCode(CORCLException::OSES_BEGINSESSION);
         /*begin session !*/
         m_nRetCode = OCISessionBegin(     m_phSvcCtx, m_phError, m_phUserSession,
                                                 OCI_CRED_RDBMS, OCI_DEFAULT);
         handleRetCode(CORCLException::OSES_BEGINSESSION);
         /* set the user session attribute in the service context handle*/
         m_nRetCode = OCIAttrSet((dvoid *)m_phSvcCtx, OCI_HTYPE_SVCCTX,
                                       (dvoid *)m_phUserSession, (ub4) 0,
                                       OCI_ATTR_SESSION, m_phError);
         handleRetCode(CORCLException::OSES_BEGINSESSION);
         m_fConnected = true;
         return true;
    - closing a session:
    void CORCLSession::endSession()
         if (m_fAttach)
              // first detach the server
              m_nRetCode = OCIServerDetach(m_phServer, m_phError, OCI_DEFAULT);
              m_fAttach = false;
         if(m_fConnected)
              m_nRetCode = OCISessionEnd(     m_phSvcCtx, m_phError,
                                                 m_phUserSession, OCI_DEFAULT);
              m_fConnected = false;
         if (m_phServer != NULL)
              // now de-alloc the server handle
              m_nRetCode = OCIHandleFree((dvoid*)m_phServer, OCI_HTYPE_SERVER);
              m_phServer = NULL;
         if (m_phError != NULL)
              m_nRetCode = OCIHandleFree((dvoid*)m_phError, OCI_HTYPE_ERROR);
              m_phError = NULL;
         if (m_phUserSession != NULL)
              m_nRetCode = OCIHandleFree((dvoid*)m_phUserSession , OCI_HTYPE_SESSION);
              m_phUserSession = NULL;
         if (m_phSvcCtx != NULL)
              m_nRetCode = OCIHandleFree((dvoid*)m_phSvcCtx , OCI_HTYPE_SVCCTX);
              m_phSvcCtx = NULL;
    }

  • Possible memory leak in e4x or HTTPService with e4x format

    Hello,
    I think I have found a memory leak in e4x.
    In very special cases (=xml) the player swallows the memory.
    The little test program connects to a web server for an xml
    file, and the result is converted to an array.
    The array is displayed in a DataGrid.
    There are two files:
    leaktest.xml doesn't leak in any cases (format: e4x or xml)
    pbentries.xml leaks when the format is e4x.
    Choose e4x format and check Use "Leak" file! Than the program
    leaks.
    For the whole test case (mxml file, html file and xml files)
    please contact me at
    [email protected]
    or
    [email protected]
    and I send a zip file as soon as possible.
    Probably there is a bug in my test program. If so than please
    send me a feedback.
    Thanks,
    Lacito
    ------ For the program cut here ------
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    layout="absolute">
    <mx:Script>
    <![CDATA[
    import mx.managers.PopUpManager;
    import mx.core.Application;
    import mx.controls.Alert;
    import mx.rpc.events.FaultEvent;
    import mx.rpc.events.ResultEvent;
    import mx.rpc.http.mxml.HTTPService;
    protected var records_:Array = null;
    protected var httpService:HTTPService = null;
    [Bindable("recordsChange")]
    public function set records(_records:Array):void
    this.records_ = _records;
    var e:Event = new Event("recordsChange");
    dispatchEvent(e);
    public function get records():Array
    return records_;
    protected function getXML():void
    var resultFormat:String = cbResultFormat.selectedItem as
    String;
    var params:Object = new Object();
    httpService = new HTTPService();
    httpService.concurrency = "single";
    httpService.showBusyCursor = true;
    var lastIndex:int = url.lastIndexOf("/");
    var fileName:String = null;
    if(chbUseLeakFile.selected)
    // It leaks... :(
    fileName = "pbentries.xml";
    else
    // It doesn't leak... :)
    fileName = "leaktest.xml";
    var _url:String = url.substr(0, lastIndex+1) + fileName;
    httpService.url = _url;
    httpService.resultFormat = resultFormat;
    httpService.method = "POST";
    httpService.addEventListener(ResultEvent.RESULT,
    processResult);
    httpService.addEventListener(FaultEvent.FAULT,
    processFault);
    httpService.send(params);
    protected function processResult(e:ResultEvent):void
    var resultFormat:String = cbResultFormat.selectedItem as
    String;
    removeListeners();
    if(resultFormat==mx.rpc.http.HTTPService.RESULT_FORMAT_XML)
    setArrayFromXMLNode();
    else
    setArrayFromXML();
    destroyHttpService();
    // format= "e4x"
    protected function setArrayFromXML():void
    var xml_:XML = httpService.lastResult as XML;
    var ar:Array = new Array();
    var x:XML = null;
    var xl:XMLList = xml_.phonebookEntries[0].phonebookEntry;
    for each(x in xl)
    var record:Object = new Object();
    var prop:XML = null;
    var props:XMLList = x.children();
    for each(prop in props)
    record[prop.localName()] = prop.toString();
    ar.push(record);
    records = ar;
    // format= "xml"
    protected function setArrayFromXMLNode():void
    var xml_:XMLNode = httpService.lastResult as XMLNode;
    var ar:Array = new Array();
    var x:XMLNode = null;
    var xl:Array = xml_.lastChild.childNodes;
    for each(x in xl)
    var record:Object = new Object();
    var prop:XMLNode = null;
    var props:Array = x.childNodes;
    for each(prop in props)
    record[prop.localName] = prop.firstChild!=null ?
    prop.firstChild.nodeValue : null;
    ar.push(record);
    records = ar;
    protected function destroyHttpService():void
    httpService.clearResult(false);
    httpService.disconnect();
    httpService = null;
    protected function processFault(e:FaultEvent):void
    removeListeners();
    Alert.show(e.fault.faultString, e.fault.faultCode);
    destroyHttpService();
    protected function removeListeners():void
    httpService.removeEventListener(ResultEvent.RESULT,
    processResult);
    httpService.removeEventListener(FaultEvent.FAULT,
    processFault);
    protected function collect():void
    // Garbage Collection
    try
    new LocalConnection().connect('foo');
    new LocalConnection().connect('foo');
    catch(e:*)
    ]]>
    </mx:Script>
    <mx:ArrayCollection id="alRecords" source="{records}"
    />
    <mx:Label x="10" y="10" text="Result format:"
    id="lResultFormat"/>
    <mx:ComboBox x="104" y="8" id="cbResultFormat">
    <mx:Array>
    <mx:String>e4x</mx:String>
    <mx:String>xml</mx:String>
    </mx:Array>
    </mx:ComboBox>
    <mx:DataGrid id="dgRecords" x="10" y="36" width="936"
    height="437"
    dataProvider="{alRecords}"
    verticalScrollPolicy="auto"
    horizontalScrollPolicy="auto">
    </mx:DataGrid>
    <mx:Button x="355" y="496" label="Get xml" id="btnGetXML"
    click="{getXML();}" />
    <mx:Button x="155" y="496" label="GC" id="btnGC"
    click="{collect();}" />
    <mx:CheckBox x="276" y="10" label="Use
    &quot;LEAK&quot; file:" labelPlacement="left"
    id="chbUseLeakFile" selected="true"/>
    </mx:Application>

    Hello,
    After 3 months (and a new version of flex and flash player)
    my test program is still leaking.
    If somebody could confirm the leak it would be appreciated.
    Thanks,
    Lacito
    P.S.: I heard that Adobe had donated ActionScript 3 VM to
    Mozilla.org. Should I disturb them with my problem?

  • Fixing Memory leaks in C code accessed via JNI

    Hi,
    I am working on an JNI interface between Java and legacy C code and I have problems with controlling the Memory inside the C code. In my application, I call many times from Java the C routines. In the C routines, memory is allocated but in a rather unclear and sloppy
    way. Not all memory is return after the C code finishes and I cannot go inside the code and release the memory block using free(). As a consequence, after a couple of runs all memory is consumed. Nevertheless, I know that all memory allocated in the C program should be available again after the C routine has finished.
    Is there a trick available that, for example, I can release all claimed memory by the C program before returning to Java, so the next time a C routine is called from Java, all free memory is again available for the C routine?
    Perhaps unloading the DLL and reloading the DLL before each C routine (how to do?).
    Or keeping track of the memory pointer before entering the C code and force it back to that position (freeing the claimed memory) after finishing the C code part (how to do?).

    Presumably you know that the correct way is to fix the C code?
    Maybe or mabe not...thinking out loud here...(and you need to check everything I say, since I am not doing the research, just pulling it out of my head.)
    The only way to do what you want is to dig deep, deep into the OS and compiler.
    Each process on the OS allocates a stack and a heap (this is not the java heap) to the process when it starts.
    You could then take a snap shot of the heap before starting. Then on exit you would free anything that wasn't in use when you started.
    However, your java app uses the same heap, so if you have any threads then it won't work. But you always have more than one thread, for instance the garbage collector. You could of course hack the jvm source to suspend all the threads (C suspension not java) to solve that problem.
    But you can't make any java method calls in your C code without doing the snap shot thing again. And I would bet that comparing the post and pre snap shots is going to take a while.
    Alternatively I do know that dlls use (or maybe used to use) either their own heap or their own stack. If it is the heap then at least the time problem won't be as much.
    I think there is also a way to replace the heap. This might be easy or hard. And either way it is probably dangerous. But if you did that then you would never have to worry about the snap shot comparison. Just throw away the new heap when you are done (give it back to the OS.)
    You might want to really look at that C code to. C programmers tended to use global variables a lot and initialize them in routines like
    static void* mylocal =0;
    void doit() { if (!mylocal) mylocal = malloc(sizeof(something)); }
    And if that occurs anywhere then switching heaps or deleting snap shots is probably not going to work.

  • Possible memory leak in JSF � help needed

    Hi,
    We are developing a JSF application using the following:
    SUN JSF 1.1_02-b08
    Tomahawk 1.1.3
    Tomcat 5.5
    Our application includes pages with lists; these lists are held and extracted from backing beans.
    We are using these beans in request scope with <t:saveState> tag (to avoid holding the lists in the session all the time).
    We tested the application using JProbe and found out that each bean that was used in the saveState was added to the view (to the session) , each time we entered the page , and the bean was not released until the end of the session (instead of only one instance of the backing bean).
    After I found this problem, I added the following context params to the web.xml:
    com.sun.faces.NUMBER_OF_VIEWS_IN_SESSION = 1 (instead of the default 15)
    com.sun.faces.NUMBER_OF_VIEWS_IN_LOGICAL_VIEW_IN_SESSION = 1 (instead of the default 15)
    We tested the application again, and now no unnecessary instances of the beans were held in the session (in the view).
    BUT , now when we use the browser �Back� button, and returning to a page with a list, when selecting an item from the list, no action is performed (the list in the server side does not exist).
    My questions are:
    1)What is the meaning (difference) of each of the context param : NUMBER_OF_VIEWS_IN_SESSION , NUMBER_OF_VIEWS_IN_LOGICAL_VIEW_IN_SESSION
    2)What are the recommended values for these parameters, to minimize session memory, and to enable the usage of the browser �Back� button.
    Thank you all,
    Lior.

    Me too.
    Please somebody knows how can we avoid memory leak problems in JSF 1.1 ?
    Thansk in advanced

  • Memory leak in xquery code in DbXml?

    While running a xml db which is update and xquery heavy, we are seeing the memory foot print grow to multiple gigs in a few minutes.
    One of the sample output from running it in valgrind is as follows.
    ==6847== 792,931,233 bytes in 4,695,090 blocks are still reachable in loss record 323 of 323
    ==6847== at 0x4A19007: malloc (in /usr/lib64/valgrind/amd64-linux/vgpreload_memcheck.so)
    ==6847== by 0x64BE0C5: BaseMemoryManager::allocate(unsigned long) (in /usr/local/maui/lib/libxqilla.so.4.0.1)
    ==6847== by 0x554A0C0: xercesc_2_8::XMemory::operator new(unsigned long, xercesc_2_8::MemoryManager*) (in /usr/local/maui/lib/libxerces-c.so.28.0)
    ==6847== by 0x64E2BC8: xercesc_2_8::RefHash2KeysTableOf<int>::RefHash2KeysTableOf(unsigned, bool, xercesc_2_8::MemoryManager*) (in /usr/local/maui/lib/libxqilla.so.4.0.1)
    ==6847== by 0x64E181E: StaticAnalysis::StaticAnalysis(XPath2MemoryManager*) (in /usr/local/maui/lib/libxqilla.so.4.0.1)
    ==6847== by 0x61A7076: DbXml::SequentialScanQP::SequentialScanQP(DbXml::ImpliedSchemaNode::Type, DbXml::ImpliedSchemaNode*, DbXml::ContainerBase*, unsigned, XPath2MemoryManager*) (QueryPlan.hpp:160)
    ==6847== by 0x61A7136: DbXml::SequentialScanQP::copy(XPath2MemoryManager*) const (XPath2MemoryManager.hpp:175)
    ==6847== by 0x619474F: DbXml::QueryPlan::createCombinations(DbXml::OptimizationContext&, std::vector<DbXml::QueryPlan*, std::allocator<DbXml::QueryPlan*> >&) const (stl_vector.h:557)
    ==6847== by 0x618DC2E: DbXml::QueryPlan::createAlternatives(DbXml::OptimizationContext&, std::vector<DbXml::QueryPlan*, std::allocator<DbXml::QueryPlan*> >&) const (QueryPlan.cpp:128)
    ==6847== by 0x61CC1D5: DbXml::LevelFilterQP::createCombinations(DbXml::OptimizationContext&, std::vector<DbXml::QueryPlan*, std::allocator<DbXml::QueryPlan*> >&) const (LevelFilterQP.cpp:101)
    ==6847== by 0x61994A0: DbXml::QueryPlan::createReducedAlternatives(double, unsigned, DbXml::OptimizationContext&, std::vector<DbXml::QueryPlan*, std::allocator<DbXml::QueryPlan*> >&) const (QueryPlan.cpp:157)
    ==6847== by 0x6182852: DbXml::StructuralJoinQP::createCombinations(DbXml::OptimizationContext&, std::vector<DbXml::QueryPlan*, std::allocator<DbXml::QueryPlan*> >&) const (StructuralJoinQP.cpp:260)
    ==6847== by 0x61994A0: DbXml::QueryPlan::createReducedAlternatives(double, unsigned, DbXml::OptimizationContext&, std::vector<DbXml::QueryPlan*, std::allocator<DbXml::QueryPlan*> >&) const (QueryPlan.cpp:157)
    ==6847== by 0x61B2C13: DbXml::NodePredicateFilterQP::createCombinations(DbXml::OptimizationContext&, std::vector<DbXml::QueryPlan*, std::allocator<DbXml::QueryPlan*> >&) const (NodePredicateFilterQP.cpp:290)
    ==6847== by 0x61994A0: DbXml::QueryPlan::createReducedAlternatives(double, unsigned, DbXml::OptimizationContext&, std::vector<DbXml::QueryPlan*, std::allocator<DbXml::QueryPlan*> >&) const (QueryPlan.cpp:157)
    ==6847== by 0x618258C: DbXml::StructuralJoinQP::applyConversionRules(DbXml::OptimizationContext&, std::vector<DbXml::QueryPlan*, std::allocator<DbXml::QueryPlan*> >&) (XPath2MemoryManager.hpp:202)
    ==6847== by 0x618355D: DbXml::ChildJoinQP::applyConversionRules(DbXml::OptimizationContext&, std::vector<DbXml::QueryPlan*, std::allocator<DbXml::QueryPlan*> >&) (ChildJoinQP.cpp:46)
    ==6847== by 0x619958D: DbXml::QueryPlan::createReducedAlternatives(double, unsigned, DbXml::OptimizationContext&, std::vector<DbXml::QueryPlan*, std::allocator<DbXml::QueryPlan*> >&) const (stl_iterator.h:614)
    ==6847== by 0x61824FE: DbXml::StructuralJoinQP::applyConversionRules(DbXml::OptimizationContext&, std::vector<DbXml::QueryPlan*, std::allocator<DbXml::QueryPlan*> >&) (XPath2MemoryManager.hpp:202)
    ==6847== by 0x619958D: DbXml::QueryPlan::createReducedAlternatives(double, unsigned, DbXml::OptimizationContext&, std::vector<DbXml::QueryPlan*, std::allocator<DbXml::QueryPlan*> >&) const (stl_iterator.h:614)
    ==6847== by 0x61B2C13: DbXml::NodePredicateFilterQP::createCombinations(DbXml::OptimizationContext&, std::vector<DbXml::QueryPlan*, std::allocator<DbXml::QueryPlan*> >&) const (NodePredicateFilterQP.cpp:290)
    ==6847== by 0x618DC2E: DbXml::QueryPlan::createAlternatives(DbXml::OptimizationContext&, std::vector<DbXml::QueryPlan*, std::allocator<DbXml::QueryPlan*> >&) const (QueryPlan.cpp:128)
    ==6847== by 0x61B25A0: DbXml::NodePredicateFilterQP::applyConversionRules(DbXml::OptimizationContext&, std::vector<DbXml::QueryPlan*, std::allocator<DbXml::QueryPlan*> >&) (XPath2MemoryManager.hpp:202)
    ==6847== by 0x619958D: DbXml::QueryPlan::createReducedAlternatives(double, unsigned, DbXml::OptimizationContext&, std::vector<DbXml::QueryPlan*, std::allocator<DbXml::QueryPlan*> >&) const (stl_iterator.h:614)
    ==6847== by 0x618258C: DbXml::StructuralJoinQP::applyConversionRules(DbXml::OptimizationContext&, std::vector<DbXml::QueryPlan*, std::allocator<DbXml::QueryPlan*> >&) (XPath2MemoryManager.hpp:202)
    ==6847== by 0x618355D: DbXml::ChildJoinQP::applyConversionRules(DbXml::OptimizationContext&, std::vector<DbXml::QueryPlan*, std::allocator<DbXml::QueryPlan*> >&) (ChildJoinQP.cpp:46)
    ==6847== by 0x619958D: DbXml::QueryPlan::createReducedAlternatives(double, unsigned, DbXml::OptimizationContext&, std::vector<DbXml::QueryPlan*, std::allocator<DbXml::QueryPlan*> >&) const (stl_iterator.h:614)
    ==6847== by 0x6182892: DbXml::StructuralJoinQP::createCombinations(DbXml::OptimizationContext&, std::vector<DbXml::QueryPlan*, std::allocator<DbXml::QueryPlan*> >&) const (StructuralJoinQP.cpp:264)
    ==6847== by 0x61CAF39: DbXml::BufferQP::createCombinations(DbXml::OptimizationContext&, std::vector<DbXml::QueryPlan*, std::allocator<DbXml::QueryPlan*> >&) const (XPath2MemoryManager.hpp:202)
    ==6847== by 0x6198964: DbXml::QueryPlan::chooseAlternative(DbXml::OptimizationContext&, char const*, bool) const (QueryPlan.cpp:291)
    ==6847== by 0x61CAD75: DbXml::BufferQP::createCombinations(DbXml::OptimizationContext&, std::vector<DbXml::QueryPlan*, std::allocator<DbXml::QueryPlan*> >&) const (BufferQP.cpp:230)
    ==6847== by 0x6198964: DbXml::QueryPlan::chooseAlternative(DbXml::OptimizationContext&, char const*, bool) const (QueryPlan.cpp:291)
    ==6847== by 0x61567BE: DbXml::QueryPlanOptimizer::optimizeQueryPlanToAST(DbXml::QueryPlanToAST*) (QueryPlanToAST.hpp:29)
    ==6847== by 0x66506E6: ASTVisitor::optimizeForTuple(ForTuple*) (in /usr/local/maui/lib/libxqilla.so.4.0.1)
    ==6847== by 0x665066A: ASTVisitor::optimizeTupleNode(TupleNode*) (in /usr/local/maui/lib/libxqilla.so.4.0.1)
    ==6847== by 0x664FF63: ASTVisitor::optimizeReturn(XQReturn*) (in /usr/local/maui/lib/libxqilla.so.4.0.1)
    ==6847== by 0x664F9B3: ASTVisitor::optimize(ASTNode*) (in /usr/local/maui/lib/libxqilla.so.4.0.1)
    ==6847== by 0x6650DBF: ASTVisitor::optimize(XQQuery*) (in /usr/local/maui/lib/libxqilla.so.4.0.1)
    ==6847== by 0x664F7A4: Optimizer::startOptimize(XQQuery*) (in /usr/local/maui/lib/libxqilla.so.4.0.1)
    ==6847== by 0x664F7A4: Optimizer::startOptimize(XQQuery*) (in /usr/local/maui/lib/libxqilla.so.4.0.1)
    ==6847== by 0x664F7A4: Optimizer::startOptimize(XQQuery*) (in /usr/local/maui/lib/libxqilla.so.4.0.1)
    ==6847== by 0x664F7A4: Optimizer::startOptimize(XQQuery*) (in /usr/local/maui/lib/libxqilla.so.4.0.1)
    ==6847== by 0x664F7A4: Optimizer::startOptimize(XQQuery*) (in /usr/local/maui/lib/libxqilla.so.4.0.1)
    ==6847== by 0x6079D98: DbXml::QueryExpression::QueryExpression(std::string const&, DbXml::XmlQueryContext&, DbXml::Transaction*) (ScopedPtr.hpp:41)
    ==6847== by 0x60D6A5B: DbXml::XmlManager::prepare(DbXml::XmlTransaction&, std::string const&, DbXml::XmlQueryContext&) (XmlManager.cpp:563)
    ==6847== by 0x60D6B70: DbXml::XmlManager::query(DbXml::XmlTransaction&, std::string const&, DbXml::XmlQueryContext&, unsigned) (XmlManager.cpp:581)
    Message was edited by:
    user626230

    This looks like a memory leak. Please correct me if I am wrong. Also, since the library uses a memory manager would'nt it be reported differently?
    They allocate a a new QueryPlan when they do a copy
    QueryPlan SequentialScanQP::copy(XPath2MemoryManager mm) const
    if(!mm) {
    mm = memMgr_;
    SequentialScanQP *result = new (mm) SequentialScanQP(nodeType_, isn_, container_, flags_, mm);
    result->nameid_ = nameid_;
    result->nsUriID_ = nsUriID_;
    result->cost_ = cost_;
    result->setLocationInfo(this);
    return result;
    Which is called from
    void QueryPlan::createCombinations(OptimizationContext &opt, QueryPlans &combinations) const
    combinations.push_back(copy(opt.getMemoryManager()));
    which is never freed here.
    void QueryPlan::createAlternatives(OptimizationContext &opt, QueryPlans &alternatives) const
    QueryPlans combinations;
    createCombinations(opt, combinations);
    // Generate the alternatives by applying conversion rules to the combinations
    for(QueryPlans::iterator it = combinations.begin(); it != combinations.end(); ++it) {
    (*it)->applyConversionRules(opt, alternatives);
    }

  • Possible Memory Leak in CF8

    Alright - not sure what type of problem this is but it is a
    problem. The scenario is this: I have an application that worked
    fine in CF7 (in terms of allocating and releasing memory) - but
    when I moved to 8 - my memory keeps growing and growing without
    anything being released (so it seems). This is a gigantic pain
    because everything works great in 8 except for memory management
    issues - I have tried all sorts of JVM argument combinations (for
    setting the garbage collection and heap sizes, GC intervals,
    etc...) - I cannot get jrun.exe to quit growing to the point it has
    to be restarted.
    Does anyone know what could be doing this? I can't turn
    memory monitor on or the app crawls - but for some reason the new
    architecture seems to disregard garbage collection (or at least on
    certain objects).
    I just find it extremelly frustrating that CF7 seems to be
    fine in terms of jrun.exe running fine with memory not going crazy
    - but CF8 just doesn't want to play nicely.
    Any help with this is greatly appreciated.
    Thanks,
    CM

    Thanks for your help ke4pym - figured it out (and this might
    help some others as well):
    We have a 2 tier web app with a database server and an
    application/web server - the database server is running
    Intersystems' Cache 5.2 and we have CF8 connected via the 'OTHER'
    selection in the datasource admin using a jdbc connection string
    and the Cache driver that ships iwth Cache. Works good - there are
    a couple benefits with doing this rather than using an ODBC
    connection (which uses a system DSN on the server and limits our
    connectivity to only queries - no stored procs or anything else -
    so essentially - the onty thing we could do with the ODBC
    connection is query the database).
    So we figured out how to connect using the jdbc connection
    and Cache driver which allowed us to then run stored proc's and
    whatever else we wanted to do in Cache via stored procedure calls -
    BUT - here is where the problem came up - for some reason - all the
    connection references or query data that was being used NEVER WAS
    RELEASED FROM MEMORY - it simply stayed there until we restarted
    the CF app server and refreshed everything. Once we put it back to
    the ODBC it works fine - doesn't use any memory for database calls
    (the main problem was that we have an email job that generates 1000
    or so reports for customers and emails them off - around 200 or so
    - the server would crash with an 'outofmemory exception' which we
    tracked down in the jre logs.
    So not sure if this is a bug or if it is just an unstable way
    of using these two technologies - but thank goodness we figured out
    that reverting back to the ODBC fixed all memory leaks (or whatever
    you want to call them). So take note anyone - IF YOU USE A
    CONNECTION STRING TO CONNECT TO A DATABASE AND SEEM TO EXPERIENCE
    MEMORY ISSUES WITH LARGE AMOUNTS OF INFORMATION BEING QUERIED FROM
    THE DATABASE - TRY USING AN ODBC CONNECTION (via a system DSN
    created in windows ODBC admin).
    Last thing - where did you find the HF2 - I only see HF1 for
    CF8 listed in the developer center - can you send a link please?
    Thanks for your help again ke4pym,
    CM

  • Possible memory leak in Oracle 12.1.0 C client

    Dear Oracle Users and Professionals,
    I want to report Oracle 12.1.0 C client memory leak when reconnect feature is on place. I have used Valgrind/massif tool to diagnostic our components and there was small memory leak in libclntsh.so.12.1 which is calling libc function getaddrinfo(). This seems to be not freed when connection is closed, but my application is still running and keep reconnect when needed.
    I sought a bit on internet and Oracle Portals about this and did not find any information that some has detected this particular issue.
    In the attachment is trace back from massif: comparison of two different time slots.
    We are developers and use only free available Oracle client versions. Our customer which will operate the system has available whole Oracle Support.
    If you can give me advice, to reach state where we will have no memory leak, it would be helpfull.
    Thank you very much
    Jan Kianicka
    ([email protected])

    Hi Jan,
        This forum is for questions about connecting to non-Oracle databases. For questions about the Oracle client connecting to Oracle databases then try either one of these forums - I am not sure which will be best -
    ODBC
    or
    General Database Discussions
    Regards,
    Mike

  • Possible Memory Leak... Real problem. Please Help

    Hello,
    About a couple of months ago I started getting a little concerned with my MacBook Pro's Hard Drive space, I deleted a bunch of stuff, after noticing I only had less than 1 Gb left, then I purchased an external HD and have used it to back up, and also to remove stuff from my hard drive in the computer. But now, I have noticed a problem that rather concerns me, If I put my computer to sleep after a normal day of work, and usage, when I wake it up it seems fine, and it runs about the same (a little less efficient, but not too much) then I realize that I am missing about 1-2 Gbs in Hard Drive Space. If I restart the computer, That memory comes back... and then If I keep using the computer, it leaks memory little by little.
    I have tried running anti-viruses and spyware software but that does not seem to work against this issue, unless I am doing something wrong. I have also tried to update all my software and keep my processes and running applications to a minimum. Finally, I tried leaving the computer on... without doing anything, connected to the internet... It leaked some more memory. I did the same, but without the internet... and then it did not leak anymore. I have no clue how this happen or how to fix it. I have tried most of the things I know could have possibly helped, but seems like isolating the problem to the internet does not really help me, since I need it for work.
    I would appreciate any suggestions or help, Thanks!!

    You are describing the natural process of virtual memory and Apple's use of a sleep image. Look in /var/vm for these files. It is not uncommon to have a sleep image of a couple of GB. Think about it. You have a computer that has data on a hard drive. When you start up the machine, that data needs to move from the hard drive to RAM and then, in some cases, back to the hard drive as virtual memory. This is when you do not have enough physical RAM to hold everything you are doing. Now, what happens when the machine goes to sleep? Well, you have data in RAM that in most cases will remain there as long as there is power. On a laptop, it is possible for the contents of RAM to be written to a file in the event of a battery depletion. THis is the suspended hibernation feature that Apple has. Commonly, there is one swapfile and one sleepimage file located in /var/vm.
    If you are missing a lot of space, you might instead want to check out your log files. It is possible that something caused a high number of log entries to be recorded and you have an incredibly large log file. Also, if your machine is not running between 3 and 4 a.m., you are missing the default maintenance scripts that run and rotate log files. Look in /var/log for unusually large logs.
    Hope this helps.

Maybe you are looking for