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.

Similar Messages

  • 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.

  • Is there any memory leaks in the version 4.6.21?

    Hi All:
    My en so weak ,so I try my best to let you understand my mean...
    I add replication to my app rencently.
    It's seem any memory leaks in the version 4.6.21.
    Threr is an env in my app's database. and there are 2000 dbs in the env. The 2000 dbs distributing In 200 directory . And the 200 directory is the subdirectory under the DATADIR.
    In the app, client and master create all subdirectory befoer the env been opened . And In my test ,if the master app use relative path to create Db and r/w data, the data will be correct send to client, The data in the master and client will keep identical.
    But, There is many memory leaks in the app.In my test ,the app will use up all memory that lead malloc failed and crash.
    the app use DB_LOG_AUTOREMOVE,DB_LOG_INMEMORY,DB_REPMGR_ACKS_NONE.
    cache_size = 500M.
    void event_callback(DbEnv* dbenv, u_int32_t which, void *info)
         bool * isMaster = (bool *)dbenv->get_app_private();
         info = NULL;                    /* Currently unused. */
         switch (which) {
         case DB_EVENT_REP_MASTER:
              *isMaster = 1;
              dbenv->errx("switch to master mode");
              break;
         case DB_EVENT_REP_CLIENT:
              *isMaster = 0;
              dbenv->errx("switch to slaver mode");
              break;
         case DB_EVENT_REP_STARTUPDONE: /* FALLTHROUGH */
         case DB_EVENT_REP_NEWMASTER:
         case DB_EVENT_REP_PERM_FAILED:
              // I don't care about this one, for now.
              break;
         default:
              dbenv->errx("ignoring event %d", which);
    Thanks
    d.j
    Message was edited by:
    user623248

    I setup logdir,datadir and envdir into different directories with
    the functions set_data_dir and set_log_dir.I created two directories
    under the datadir and created more than 100 sub-directories
    respectively for the two dir, where the 2000 databases located.By the way, even though it doesn't seem likely to be the cause of the
    memory leak, you should still fix this illegal usage of subdirectories
    before we get much further investigating. We might as well eliminate
    any possible source of problem, no matter how unlikely it seems.
    Also, just as an experiment, I would be very tempted to try running
    again without using any separate directories. In other words, don't
    call set_data_dir or set_log_dir at all, and just let everything be
    put into the one single directory. If that changes the results, that
    will be a big clue to help us know where to look for the problem.
    I'am writting a demo , but it take time.
    i will reply later .Thank you. Take your time -- we'll be here.
    Alan Bram
    Oracle

  • 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 of memory leak in the loop

    Recently my application do get OutOfMemory issue. I realized the memory is keep on stack up as i saw in the task manager, the jlaunch keep growing and it won't drop back. That day i'm running a search function and it will query the table to retrieve the data. The jlaunch shoot from 500MB -> 2.2GB and now remain in there. Wondering is it during it query it populate at least 10,000 records into the arraylist and then the memory already allocated and once i finish run the function, it will clear the allocated memory to re-use it.
    public ArrayList ejbHomeInJDBCConnection(Map map){
         ArrayList beanList = new ArrayList();
         try{
              Context ctx = new InitialContext();
              DataSource ds = (DataSource) ctx.lookup("jdbc/POOL");
              Connection con = ds.getConnection();
              String query = "SELECT * FROM USER WHERE ";
              for (Iterator iterator = map.keySet().iterator(); iterator.hasNext();) {
                   Object key = iterator.next();
                   if(key.toString().startsWith("TIME") | key.toString().startsWith("TIMEIN")){
                        long longValue = Long.parseLong(map.get(key).toString());
                        query += key.toString()+ longValue + " AND ";      
                   }else{
                        String value = (String)map.get(key);
                        query += key.toString()+ value + " AND ";      
              String newquery = query.substring(0, query.length()-5);
              newquery += " ORDER BY TIMEIN DESC";
              Statement stmt = con.createStatement();
              try {
                   ResultSet rs = stmt.executeQuery(newquery);
                  try {
                        while (rs.next()){
                             InBean bean = new InBean();
                             bean.setSmsId(rs.getString("EMP"));
                             beanList.add(bean);
                   }finally{
                        rs.close();
              }finally{
                   stmt.close();
         }catch(Exception e){
              System.err.println(e.fillInStackTrace());
    return beanList;
    Wondering is it the InBean will cause any memory leak as if there is 10,000 records, which mean it will create 10,000 objects and once it add into the arraylist the previous bean is not in use, will the GC clear it as i didn't set it as null. Do i need to do something like reallocate/defragment the memory?
    Thanks.

    Hi,
    I'm sure a "count" would not generate the overhead you are concerned.
    To understand some aspects, you need to read the source files of Java, and understand how the stack would work in your case.
    Evertime you "add" an element to you list, the implementation will run the ensureCapacity, and grown the list one by one. Understand that the list is an Array with a lot more functions, but below, you are still working with an Array, and it needs to have a defined size. Everytime you add, it's doing a System.arraycopy(all the crap) - So you can save this, everytime you add something if you create your List with the right size.
    Note, this is not an issue if we consider small lists, of small objects, but working with large lists, you can feel slow downs.
    About the GC stuff, well.. I'm sure you can do some reading how it works. One good start point would be
    Link: [http://java.sun.com/docs/hotspot/gc1.4.2/]
    I'm sure you don't need that, but still, it's good reading. Maybe you should just increase your heap size, or you can manually clear the List using list.clear();
    Rgds,
    Daniel

  • 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 Weblogic 7.0

    We have developed an EJB application on Weblogic 7.0 running on HP-UX 11.0. Some
    JSP/Javabean programs, that lookup EJB compoments for services, are developed
    on the Resin web server to serve browser requests. Both Resin and Weblogic are
    running on the same HP machine. JDK version is 1.3.1_06 for HP-UX.
    The real memory is 2GB. Tha parameters to start Resin server are
    -showversion -verbose:gc -Xms384m -Xmx384m -Xoptimize
    The parameters to startup Weblogic are in the following:
    -server -showversion -verbose:gc -Xms768m -Xmx768m -XX:NewSize=256m -XX:SurvivorRatio=6
    -Xoptimize -XdoCloseWithReadPending
    In our observations, the peak traffic is during the working hours. Only few users
    (less than 40 users) stay in our system in the night and holidays.
    And in our observations, the weblogic will do the GC if necessary. But some memory
    are lost after each GC even not in the peak time. Thus, after running two or three
    days, there are only lillte free memory for use, and the Weblogic begins to take
    much time (10-30 seconds ) doing GC more often and often. At last, an OutOfMemory
    error generated.
    I hope that Weglogic can serve all the time.
    Does anybody han as experience on this problem?

    Thanks for your kinfness.
    We have wrote some single-user applications to test the Weblogic 7.0. We doubt
    it is JDBC driver's problem.
    We downloaded the Informix JDBC driver 2.21_JC2 to replace the older version 2.20_JC1
    and retest our applications. The memory usage curve looks much better and the
    applications run over three days.
    We will continue to observe the execution. Maybe the JDBC driver is the real problem.
    "Aravind Krishnasamy" <[email protected]> wrote:
    I am not sure whether it's an application problem or application server
    problem. Both are possible. I am not familar with HP Java Version.
    It may be a problem due to loitering object. You can try doing testing
    with
    single user and the memory needs for the user.
    NoteThe memory level before the test and after the test
    Foce GC and you need to GC same level of HEAP Used, Profiling tools will
    be
    helpful to find application problem
    Aravind
    "Wen-Hung Yeh" <[email protected]> wrote in message
    news:[email protected]...
    We have developed an EJB application on Weblogic 7.0 running on HP-UX11.0. Some
    JSP/Javabean programs, that lookup EJB compoments for services, aredeveloped
    on the Resin web server to serve browser requests. Both Resin and Weblogicare
    running on the same HP machine. JDK version is 1.3.1_06 for HP-UX.
    The real memory is 2GB. Tha parameters to start Resin server are
    -showversion -verbose:gc -Xms384m -Xmx384m -Xoptimize
    The parameters to startup Weblogic are in the following:
    -server -showversion -verbose:gc -Xms768m -Xmx768m -XX:NewSize=256m-XX:Su
    rvivorRatio=6
    -Xoptimize -XdoCloseWithReadPending
    In our observations, the peak traffic is during the working hours.Only
    few users
    (less than 40 users) stay in our system in the night and holidays.
    And in our observations, the weblogic will do the GC if necessary.But
    some memory
    are lost after each GC even not in the peak time. Thus, after runningtwo
    or three
    days, there are only lillte free memory for use, and the Weblogic beginsto take
    much time (10-30 seconds ) doing GC more often and often. At last,an
    OutOfMemory
    error generated.
    I hope that Weglogic can serve all the time.
    Does anybody han as experience on this problem?

  • Memory leak on the native side

    Hello,
    I am hoping someone here can offer some troubleshooting advice, as I am completely stumped. I am running JBoss 5.1 with JDK 1.6_u18 (same problem with u17 and u16 too)
    - 32-bit, Linux (RHEL 5).
    - min/max heap setting of 1024M
    - permgen max of 256M
    - Thread stack size of 128K
    - No JNI
    My problem: The memory footprint of the JVM slowly grows until it hits the 3G OS limit. This takes about 8 hours under moderate load. At this time, it of course dies as it has no more addressable memory left.
    Here is the strange part: I have used every possible memory debugging tool (jmap, Eclipse MAT, etc) and nothing looks out of the ordinary in my Java heap. Thread count stays at a reasonable 350 threads, Java heap size stabilizes at about 500M. For the first hour or so, the JVM footprint stays at about 1.7G, which makes sense. After that it starts to slowly grow until in exceeds the 3G limit.
    What can I do to figure out where the leak is occurring? There is clearly some native resource that is being allocated but not freed. As I indicated, all the Java analysis tools report a healthy, stable heap and thread count.
    Thanks in advance.
    Jon

    Thanks for the reply.
    I have confirmed with -verbose:jni that the only JNI libraries getting loaded are those belonging to the JDK. My application does make heavy use of the ProcessClassLoader from the Jboss JBPM library, but classes all seem to be unloading normally, and my Permgen usage stays very low and stable. Is there anything I should look at in regards to this class loader? I have tried both a lack of GC parameters and specified the concurrent mark sweep collector, with the same results.

  • Memory Leak with the new PatchMix App Beta?

    E6300/ASUS P5B-D/2GB RAM/EMU 0404/Vista Ultimate 32bit
    The problem happens after I upgrade to the PatchMix driver set dated 9/11.
    The physical memory usage bumps from ~24M to 150M after running 24 hours, and I didnt load any FX.
    The commit size(real memory usage) is over 500M!
    This doesnt happen with the old beta driver.
    Anyone has the same problem?

    Emon wrote:
    jreid wrote:
    Dare I suggest the problem might be Vista?
    Yes? How exactly would Vista cause a memory leak within PatchMix DSP's GUI?
    Well, just a thought. The OS is ultimately responsible for all memory management, and also the low-level graphics functions that would be called by e.g. the GUI code. I just noticed that people on XP didn't seem to be having the same problems with this beta.

  • 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 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 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 forms api 6i

    There appears to be a bug in forms 6i.
    I am getting an error at the following snippet of code. The Name prints fine and the whole code runs great if i comment out free(v_value), but obviously i would not want to do that.
    I am using MS VC++ 6.0 compiler,
    The error is::
    HEAP[xephr.exe]: Invalid Address specified to RtlFreeHeap( 3540000, 364fc08 )
    This means that i am trying to free the memory which has already been freed, meaning thereby that api has already freed the memory associated with name. But then why should the api function d2fobgt_GetTextProp free the memory allocated for name as i am supposed to free it.
    Now that appears to be a bug.
    Please suggest...
    Here is that relevant code snippet...
    text* name;
    if (d2fobgt_GetTextProp(ctx, p_obj, prop_num, &name)==D2FS_SUCCESS)
    printf("\nName=%s\n", name); /* prints the name properly*/
    if ( v_value!=NULL )
    free(v_value); /* Raises error, Invalid Address specified to RtlFreeHeap, the error disappears if i
    comment out the free(value) line. */

    Hello :)
    I read your message cause i look for a answer to a big problem i encountered while trying sample code from Oracle Forms API : it's impossible to create the Forms API Context, the d2fctxcr_Create() function always return D2FS_FAIL.
    As your problem seem to be happened after this call, i wonder you can create the context without errors.
    Here the code I used, so perhaps you can see my error (I compile under VC6) :
    int main (int argc, char *argv[])
    d2fctxa ctx_attr;
    d2fctx *ctx;
    d2fstatus status;
    /* Create Forms API context */
    ctx_attr.mask_d2fctxa = 0;
    if ( (status=d2fctxcr_Create(&ctx, &ctx_attr)) != D2FS_SUCCESS )
    fprintf(stderr, "Error creating Forms API context (%d)\n",status);
    exit(1); /* ALWAYS GO THERE */

Maybe you are looking for