Memory Leak in QTPlugin ? (QT7, and QT 6.5+)

Trying to track this down, there is a problem with a memory leak when doing a endless loop quicktime sequence of images. To get the loop, I've created a SMIL file with the images, then have a HTML page that uses the EMBED tag to reference these SMIL files via QTNEXTxx, with a final GOTO0 to get back to the start.
It works, but if you watch the process with Activity Monitor (or top) you can see that memory consumption grows over time and will eventually crash whatever browser you are using. This happens if I open the HTML file with Safari, iCab, Opera, Firefox, RealPlayer, etc...
Very simple example with even one image will leak memory, albeit at a slower pace:
HTML: (replaced brackets with curly braces)
{html}
{head}
{title}radarLoops.html{/title}
{/head}
{body bgcolor="#000000"}
{center}
{embed src="file1.smil BGCOLOR="#000000" autoplay="true" controller="false" width="800" height="620" pluginspage="http://www.apple.com/quicktime/download/" QTNEXT1="GOTO0"}
{/center}
{/body}
{/html}
file1.smil:
SMILtext{smil xmlns:qt="http://www.apple.com/quicktime/resources/smilextensions" qt:autoplay="true" qt:time-slider="false"}
{head}
{layout}
{root-layout width="800" height="620" background-color="black" /}
{region id="region_1" left="0" top="0" width="800" height="620" fit="fill" /}
{/layout}
{/head}
{body}
{seq}
{img src="TEST.JPG" region="region_1" dur="1s" /}
{/seq}
{/body}
{/smil}
To workaround this issue, we had to revert to a 10.3.x system with QT6.4.x on it, reverting a 10.3.9 to QT6.5.x didn't work. A Tiger installation with 7.0.3 doesn't work either, it leaks like a sieve.
How can I debug this?

Write a main() that does the polling in a tight loop 1000 times. Then System.gc(); Thread.sleep(1000); System.exit(). Run the thing with -Xrunhprof. Observe the "live bytes" and "live objs" columns in the generated java.hprof.txt file. Anything that strikes as suspicious? If every polling round leaks one object, there's likely to be 1000 (or N*1000) of something live. Make sure the leak is in the polling routine by running it 1,000,000 rounds and getting an OutOfMemory.

Similar Messages

  • Memory leak in oracle.exe and mds.exe

    We are facing Memory leak in oue MDM server. Our environment details
    are as follows;
    MDM 5.5 SP5 ( Build 5.5.41.70)
    Oracle 10.2 patch 2
    windows server 2003 SP1
    XI 7.0 SP 9
    If server is running continuously 3-4 days then Nonpaged memory is
    getting exausted and server does not respond. Now we have to retart the
    windows server manually.
    If we see the task manager it is shows more than 200,000 handles for
    oracle.exe and more than 100,000 handles for mds.exe.
    1: Oracle.exe -- more than 200000 handles ( Approx >5000 is problem)
    2: Mds.exe -- more than 100000 handles ( Approx >5000 is problem)
    Since these applications are not releasing the handles properly so all
    nonpaged memory gets exausted and server stops responding.
    If we restart the mdm server, database and OracleserviceMDMD, then
    nonpaged memory is released. But some times even if we restart these
    services, we do not get nonpaged memory released. So we have to restart
    the windows server.
    please help me if anyone else have faced the same problem.
    regards
    Saurabh

    Closing as question is answered in MDM forum.

  • Memory leak with large files and this code?

    Okay, so the following code will not complete. 
    Basically what I am doing is opening 5 files and generating a PDF document from the already opened Report file, which is renewed prior to the PDF export operation.  I left out the general stuff at the start.  I am also writing out the location of the PDF to a HTML file, which acts as an index of the exported PDF documents.
    I believe it is due to some sort of memory leak issue, but it could be something else or just my code.  I have not stepped through this code, but for small file sizes of say less than 40 megs per file, it works fine.  For file sizes along these lines:
    File 1 = 230 megs
    File 2,3 = 26 megs
    File 4,5 = 8 megs
    it will belch erors at the end of about the 5th iteration through the For loop.  It will complete the 5th iteration however.  Here are the errors generated:
    84   10/26/2006 9:35:15 AM Error:
    85   File handle for "W:\TR-2051-2100\TR-2060 - BAS Arctic PTC\Vnom\00-99\VnomCombined00-99\p1.TDM" file is invalid.
         (Error no. 6)
    86   10/26/2006 9:40:19 AM Error:
    87   File handle for "W:\TR-2051-2100\TR-2060 - BAS Arctic PTC\Vnom\00-99\VnomCombined00-99\p2.TDM" file is invalid.
         (Error no. 6)
    88   10/26/2006 9:45:17 AM Error:
    89   File handle for "W:\TR-2051-2100\TR-2060 - BAS Arctic PTC\Vnom\00-99\VnomCombined00-99\p3.TDM" file is invalid.
         (Error no. 6)
    90   10/26/2006 9:53:07 AM Error:
    91   File handle for "W:\TR-2051-2100\TR-2060 - BAS Arctic PTC\Vnom\00-99\VnomCombined00-99\p8.TDM" file is invalid.
         (Error no. 6)
    92   10/26/2006 10:00:39 AM Error:
    93   File handle for "W:\TR-2051-2100\TR-2060 - BAS Arctic PTC\Vnom\00-99\VnomCombined00-99\p9.TDM" file is invalid.
         (Error no. 6)
    94   10/26/2006 10:01:01 AM Error:Error occured during file creation.
    95   10/26/2006 10:01:01 AM Error:
         Error in <GM315 Pa...sing.VBS> (Line: 185, Column: 5):
         File handle for "W:\TR-2051-2100\TR-2060 - BAS Arctic PTC\Vnom\00-99\VnomCombined00-99\p1.TDM" file is invalid.
         (Error no. 6)
    For files of a larger size, like:
    File 1 = 7500 megs
    File 2,3 = 80 megs
    File 4,5 = 25 megs
    This occurs after about 2-3 iterations through the loop.
    see attachment for code.
    Attachments:
    ForLoopCode.txt ‏11 KB

    i am having a similar error randomly inserted in the log 
    25   10/1/2009 1:58:36 PM Error:
    26   File handle for "C:\Program Files\Summitek\Spartan\data\tdm\S Parameter Test $SSN$ 49.TDMS" file is invalid.
         (Error no. 6)
    and
    31   10/1/2009 1:58:37 PM Error:
    32   File handle for "C:\Program Files\Summitek\Spartan\www\temp\Test_$SSN$ 49_602313172.pdf" file is invalid.
         (Error no. 6)
    it doesn't seem to be causing an immediate problem, but i have had several unexplained Diadem lockups.
    they occur in log after i use CALL DATAFILELOADSEL and CALL PICpdfexport
    help? what does this mean
    jim

  • Memory Leak when just launched and Idle..  fixes when being used ??  [HELP]

    So I'm in the debugging and testing phase of my app and using this tool for tracking memory leaks ( https://github.com/mrdoob/Hi-ReS-Stats )
    When I launch my app my numbers are
    FPS: 61/60
    MS: 17
    MEM: 3.157
    MAX: 3.157
    Now immediately my memory starts increasing    from  3.157, 3.167, 3.177, 3.187, 3.197 and so on.
    Now if I make any nav selection in my app
    MEM changes back down to about 3.215
    but then it starts its count again   3.215, 3.225,  3.235, 3.445, 3.455
    I don't have any loops happening.
    Has anyone run in to this ?
    I'm almost tempted to force garbage collection every 60 seconds that the app is idle or something.  Not the best way to handle this ..   I just dont know where the leak is happening.
    Any support is appreciated!
    Cheers!

    Hi there - I just had the same query a couple of days ago (http://forums.adobe.com/thread/977174?tstart=30).
    I saw the same symptoms on my app so I built a blank app with just the profiler on stage. I've been monitoring it for a few days now and notice that memory does creep up even when the app is left idle (apart from the profiler) - but ... and this is the important bit ... it does periodically get reduced back to the starting point (when the garbage collector kicks in and memory is released).
    When I was monitoring my app the time through this cycle could be well over 5 mins.
    If you actually use the monitor when putting your app through it's paces you'll see memory being gobbled up more rapidly and hopefully (if you've no leaks) the garbage collection kicking in more regularly and bringing the reported usage back down.

  • Memory leaks continuing in Safari and Web Kit

    Will Apple ever fix the Safari memory leak?
    As many of you know lots of reports over the years of Safari & Webkit having problems with memory leaks, and haven't seen a fix to it yet. This is a very important factor for usability of Safari.
    A memory leak is when, after a period of time, your browser, which is the online field that's designed to function like a page and is used to access web pages and surf the World Wide Web, consumes more and more of your computer's memory until it reaches a point where it literally becomes impossible to use your computer. It's like your computer's stuck in cyber mud. You have to close any open software program or restart the entire computer.
    Safari starts about 426.9 MB of real memory and 412.6 MB of virtual memormy and can go up to 1Gb of memory.
    Has anyone come up with a fix to this problem ? If anyone has a workaround for this, please share it.
    Meanwhile, Apple really should eliminate this problem once and for all.
    FYI, I'm using Safari version 5.0.3 and the latest WebKit r72487 which was built on 21 November 2010.

    My experience is that the same thing happens with Firefox and Chrome. The only difference with Chrome is that since the tabs are separate threads, they consume memory separately. The nice thing about that is that once the tab is closed memory is instantly freed. However, the helper thread always gets larger. Whether this is a memory leak or a consequence of having an application open over a long period of time is -I believe- open to discussion. I have experienced similar results with Eclipse (a memory intensive application). Daily shutdown/reboot and a few "Quit"s per a few hours fixes this issue. I don't know whether you would like to do this, though.
    Using Safari 5.0.2.

  • Memory Leak/Track Pad/Mouse and Headphone Jack

    Help-
    I have a Macbook with the intel core duo. 4 GB of RAM.
    Context.
    Computer is used as a media server. Stereo is connected via an optical link from the headphone jack to an external digital to audio converter. Music is stored on external 1 TB My book. Computer is left on and idle for extended periods of time.
    Problem:
    As the computer is left idle, the trackpad/mouse become increasingly unresponsive. Eventually they stop responding all together. Un-responsive means they jump and can not be maneuvered around the screen in smooth movements. System fan begins to run as this problem gets worse and system monitor indicates memory continuing to be consumed despite no applications running other than startup apps. ---*When the optical jack is removed from the headphone jack this problem disappears*--- and the system returns to normal.
    Please help. I specifically purchased the macbook to serve as the platform for this media server and leaving it running for extended periods of time with no use is normal for me. Having the computer lock up because I have the optical headphone jack plugged in is unsat.
    Thanks -
    Hud

    i also made a topic about this, i'm not sure if you're still watching it, but I found the solution by coincidence when playing around on youtube.
    http://jp.youtube.com/watch?v=iAQ79JT0agY&feature=related
    "Discovered it was an issue with the headset jack. Something was triggering the digital audio jack inside. Simply cleaned the jacks and everything started to work again."
    I didn't mention earlier that when i left my headset connected, the volume icon in the menubar would go up and down in short intervals (similar to the youtube clip) Even though I can't understand how, this must have been the issue, as I just cleaned the jack, and the problem is gone. Hope this helps you as well!

  • Memory leak and char[] ?

    Hello all,
    I'm not sure whether this post should be here or in WebLogic section, so correct me if I'm wrong.
    I'm working on JDeveloper 11.1.1.3 while deployments are made on standalone WebLogic 10.3.3. This thing occurred in previous versions also.
    With every deployment WebLogic increases it's used memory until the famous PermGen space error, which is after about 5-6 deployments.
    I'm doing my best to understand how to use memleak detection tools. I've switched JDev and WL from Sun jdk which was used before to JRockit, same thing happens. Both JDev's memory profiler and JRockit mission control show something that I really do not understand. char[] uses around 30% of heap space and keeps growing with deployments, next is String with 8%. I never use char in app.
    Am I looking at the wrong thing? Is it normal for char[] to increase on WebLogic on deployments? Does anyone know how to check other things and what to check? Someone on other forums mentioned it would be useful to check if ApplicationContext keeps initializing over again on deployments. Does anyone know how to check this?
    One more thing, I have successfully deployed app on Tomcat, and Tomcat said there is a memory leak in app, but could not tell anything specific.
    I'm kinda lost in this :(

    It is normal for the PermGen space of the Sun's JVM to get filled after several re-deployments. PermGen stands for "permanent generational". This space is used by classes that is unlikely to need to be garbage-collected, so they are placed in this memory space that is never garbage-collected (for example, the Class instances). When you redeploy an application, a new class loader instance is used and it instantiates new Class instances that fill up the PermGen space. But why this happens on JRockit either, I could not explain.
    We have experienced memory leaks related to classes and components that use native memory. For example, we have had significant memory leak when using Oracle's JDBC OCI driver. We were not able to solve this problem, so we switched to JDBC Thin driver (which is very performant and stable today comparing to some years ago). If you are using Oracle JRockit, you can monitor the overall memory usage by the following JRockit command executed at OS command line:
    jrcmd <jrockit_pid> print_memusage>where <jrockit_pid> should be replaced by the JVM process ID.
    If you suspect existence of native memory leaks, then have a look at the article Thanks for the memory for explanations about how Java uses native memory.
    Dimitar

  • JBoss EAP 6 On JRockit - Memory Leak

    hello team.
    I have memory leak problem on jboss and jrockit.
    My Environment :
    1. OS :          
    CentOS release 6.4 (Final)
    2. JRockit :     
    java version "1.6.0_45"
         Java(TM) SE Runtime Environment (build 1.6.0_45-b06)
         Oracle JRockit(R) (build R28.2.7-7-155314-1.6.0_45-20130329-0641-linux-x86_64, compiled mode)
    3. Application Server:
    JBoss EAP 6.2.0.GA
    4. Application
    Large EJB Application (100 and more EJB Beans (Stateless, Stateful,  MDB, Timers and so on)
    Everything works fine on older application server versions (4.3 , 4.2)
    But now I have Problem
    Of course I know that problem is new version - and i have discussion on JBoss forums.
    but guys I have question about jrockit with you:
    What is the option "Other" in memory ??
    [jboss@jboss-new bin]$ jrcmd 17114  print_memusage
    17114:
    Total mapped                       8457864KB           (reserved=2983100KB)
    -              Java heap              3145728KB           (reserved=0KB)
    -              GC tables            105232KB         
    -          Thread stacks       46412KB           (#threads=138)
    -          Compiled code       1048576KB           (used=12257KB)
    -               Internal                   1480KB         
    -                     OS       170324KB         
    -                  Other       3639056KB         
    -            Classblocks         10496KB           (malloced=9631KB #28393)
    -        Java class data       289536KB           (malloced=192391KB #133697 in 28393 classes)
    - Native memory tracking     1024KB           (malloced=294KB #10)
    [jboss@jboss-new bin]$
    This size increases every time - and took entire amount of RAM.
    Thank in Advance.
    Regards,
    Paata Lominadze

    Not sure what the 'other' is, but it is probably best shown by using an example. By using displayMap we can display a memory map of various JVM subsystems and libraries that are loaded, including third-party libraries.
    ./jrcmd 4523 print_memusage displayMap
    Total mapped                  3984796KB           (reserved=2978740KB)
    -              Java heap       524288KB           (reserved=0KB)
    -              GC tables        17548KB         
    -          Thread stacks        20276KB           (#threads=39)
    -          Compiled code      1048576KB           (used=14224KB)
    -               Internal         1672KB         
    -                     OS       146924KB         
    -                  Other      2092648KB         
    -            Classblocks         7424KB           (malloced=7381KB #20064)
    -        Java class data       124416KB           (malloced=124411KB #91048 in 20064 classes)
    - Native memory tracking         1024KB           (malloced=118KB #10)
    +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
        OS                          *java    r x 0x0000000000400000.(     76KB)
        OS                          *java    rw  0x0000000000612000.(      4KB)
        OS                        *[heap]    rw  0x00000000007c1000.(    132KB)
       INT                           Poll    r   0x000000007fffe000 (      4KB)
       INT                         Membar    rw  0x000000007ffff000.(      4KB)
       MSP              Classblocks (1/2)    rw  0x00000000df8c0000 (   6912KB)
       MSP              Classblocks (2/2)    rw  0x00000000dff80000 (    512KB)
      HEAP                      Java heap    rw  0x00000000e0000000.( 524288KB)
        OS                    *ld-2.12.so    r x 0x0000003664400000.(    128KB)
        OS                    *ld-2.12.so    r   0x000000366461f000 (      4KB)
        OS                    *ld-2.12.so    rw  0x0000003664620000 (      4KB)
        OS                   **ld-2.12.so    rw  0x0000003664621000.(      4KB)
       OS           *gconv-modules.cache    r   0x00007f8f2e4a0000 (     28KB)
    THREAD                     Stack 4630    rwx 0x00007f8f2e4a7000 (      8KB)
    THREAD                     Stack 4630        0x00007f8f2e4a9000 (     12KB)
    THREAD                     Stack 4630    rwx 0x00007f8f2e4ac000 (    244KB)
       MSP         Java class data (5/37)    rw  0x00007f8f2e4e9000 (  14336KB)
       MSP         Java class data (9/37)    rw  0x00007f8f2fa40000 (   5888KB)
                                             rw  0x00007f8f30000000 (    188KB)
                                                 0x00007f8f3002f000 (  65348KB)
                                             rw  0x00007f8f34000000 (    132KB)
                                                 0x00007f8f34021000 (  65404KB)
                                             rw  0x00007f8f38000000 (    412KB)
                                                 0x00007f8f38067000.(  65124KB)
       MSP        Java class data (10/37)    rw  0x00007f8f3c034000 (  34048KB)
                                             rw  0x00007f8f3e174000 (   8200KB)
       MSP        Java class data (11/37)    rw  0x00007f8f3e976000 (    256KB)
        OS                     *libhpi.so    rw  0x00007f8fb37fc000 (      8KB)
        OS                    **libhpi.so    rw  0x00007f8fb37fe000 (      4KB)
      CODE                  Compiled code    rwx 0x00007f8fb37ff000 (     64KB)
      CODE                  Compiled code    rwx 0x00007f8fb380f000 (    128KB)
      CODE                  Compiled code    rwx 0x00007f8fb382f000 (     64KB)
      MSP        Java class data (37/37)    rw  0x00007f8ff83a1000 (    512KB)
        GC Modified Union Set (committed)    rw  0x00007f8ff8421000 (    132KB)
        GC                     Card table    rw  0x00007f8ff8442000 (   1024KB)
        GC        Object bits (committed)    rw  0x00007f8ff8542000 (   8196KB)
    Here
    - thread is thread related (such as thread stacks)
    - int, internal use (such as pointer pages)
    - heap, chunk used by JRockit for the Java heap
    - os, mapped directly from the operating system, such as third party DLLs or shared objects
    - msp, memory space. a memory space is a native heap with a specific purpose, for example native memory allocation inside the JVM
    - gc, garbage collection related, for example live bits
    - code, compiled code
    The 'other' memory space looks to me (from the blank entries in the above print-out) like they are a memory pages to are still not used. When the JVM starts it mappes an amount of memory. To my knowledge JRockit uses mmap (mmap(2) - Linux manual page), which creates a new mapping in the virtual address space. JRockit reserves an amount of memory (Java Heap (heap where your object instances go) + its own runtime (all the others)).
    To see where the growth is in the various memory spaces, you can use 'print_memusage baseline', after which you can execute print_memusage again, for example,
    ./jrcmd 4523 print_memusage scale=M
    4523:
    Total mapped                     3896MB      +4MB (reserved=2905MB -3MB)
    -              Java heap          512MB           (reserved=0MB)
    -              GC tables           17MB         
    -          Thread stacks           19MB           (#threads=39)
    -          Compiled code         1024MB           (used=14MB +1MB)
    -               Internal            1MB         
    -                     OS          143MB         
    -                  Other         2043MB         
    -            Classblocks            7MB           (malloced=7MB #20596 +532)
    -        Java class data          126MB      +4MB (malloced=125MB +4MB #93640 +2592 in 20596 classes)
    - Native memory tracking            1MB           (malloced=0MB #20 +10)
    Note the additional column that prints out the difference in memory usage in relation to the baseline. You can also monitor native allocations by using trace_alloc_sites, memory allocations can then be displayed with different levels of detail using the level argument.
    ./jrcmd 4523 print_memusage trace_alloc_sites=true
    4523:
    Total mapped                  3989660KB   +4864KB (reserved=2974732KB -4008KB)
    -              Java heap       524288KB           (reserved=0KB)
    -              GC tables        17548KB         
    -          Thread stacks        20276KB           (#threads=39)
    -          Compiled code      1048576KB           (used=15265KB +1040KB)
    -               Internal         1672KB         
    -                     OS       146924KB         
    -                  Other      2092648KB         
    -            Classblocks         7680KB    +256KB (malloced=7669KB +287KB #20596 +532)
    -        Java class data       129024KB   +4608KB (malloced=128967KB +4555KB #93640 +2592 in 20596 classes)
    - Native memory tracking         1024KB           (malloced=236KB +118KB #20 +10)
    ./jrcmd 4523 print_memusage level=3
    4523:
    Total mapped                  3989660KB   +4864KB (reserved=2974732KB -4008KB)
    -              Java heap       524288KB           (reserved=0KB)
    -              GC tables        17548KB         
    -          Thread stacks        20276KB           (#threads=39)
    -          Compiled code      1048576KB           (used=15265KB +1040KB)
    -               Internal         1672KB         
    -                     OS       146924KB         
    -                  Other      2092648KB         
    -            Classblocks         7680KB    +256KB (malloced=2KB -7379KB #4 -20060) Not fully traced
    -        Java class data       129024KB   +4608KB (malloced=26KB -124385KB #16 -91032 in 20596 classes) Not fully traced.
    - Native memory tracking         1024KB           (malloced=118KB #10) Not fully traced.
         gather_memorymap_database                     memtrace.c: 206         91KB     +91KB (#1 +1)
               gather_memory_usage                  osal_mspace.c:5142          7KB      +7KB (#4 +4)
      msGatherMSpacesUsageDatabase                  osal_mspace.c:6128          2KB      +2KB (#1 +1)
      msGatherMSpacesUsageDatabase                  osal_mspace.c:6134         16KB     +16KB (#1 +1)
    Note this is more on the JVM level, in your case in might be beneficial to investigate what is happening on the java heap. By using print_object_summary you can get insight how memory on the heap is used on a per-class basis. To get to the bottom of where the memory leak is you can use the memory-leak-detector (an example of its use can be found here Middleware Snippets: Fast, Faster, JRockit). You can also obtain a heapdump that can be analyzed by using for example MAT (see for an example here Middleware Snippets: Visualizing Class Loading). To obtain a heapdump you can run the command, for example,
    [weblogic@machine1 bin]$ ./jrcmd 4523 runsystemgc full=true fullcompact=true
    4523:
    [weblogic@machine1 bin]$ ./jrcmd 4523 hprofdump filename=/home/weblogic/dump.hprof
    4523:
    Wrote dump to /home/weblogic/dump.hprof
    Note that this first issues a full GC by using the runsystemgc command.

  • Memory leak in c++ application

    This one line of code is creating a memory leak in my application and I'm not sure what to do after this statement to prevent this from happening.
    Here's the line of code:
    oracle::occi::PObject * pObject = m_statement->getObject( 3 );

    This forum is for general programming questions, and for questions about Studio.
    Questions specifically about OCCI are more likely to get a helpful answer in the OCCI forum:
    C++ Call Interface (OCCI)
    (You can find this and other data-base related forums at forums.oracle.com, then expand the Oracle Database item, then click "more".)

  • Memory leak in VM

    Hello,
    I'd like to point out a memory leak in the VM, and it is very annoying for the application I'm working on. Here is the code that shows the problem :
    import java.awt.Image;
    import java.awt.Toolkit;
    import java.io.File;
    import java.lang.management.MemoryMXBean;
    import sun.management.ManagementFactory;
    public final class MemoryLeak {
         private static final void printUsedMem(final MemoryMXBean mx) {
              // I force garbage collection twice to be sure !
              System.gc();
              System.gc();
              System.out.println(mx.getHeapMemoryUsage().getUsed());
         public static final void main(final String[] args) {
              final MemoryMXBean mx = ManagementFactory.getMemoryMXBean();
              final File imageFile = new File("D:\\TEMP\\test1.jpg");
              printUsedMem(mx);
              Image image = Toolkit.getDefaultToolkit().createImage(
                      imageFile.getAbsolutePath());
              printUsedMem(mx);
              image = null;
              printUsedMem(mx);
    }This prints :
    149728
    221144
    221144The last line should be the same as the first one !
    I'm using jdk 1.5.0_11, on a Windows platform. I found people having the same problem, and the bug is referenced in your database and known for 12 years.
    Bug ID : #4014323
    Link : http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4014323
    Can you give me a workaround for this problem please ?
    Thank you.

    I realize that you're a one-post-wonder, who for some reason thinks that this forum is a direct line to the Sun development team (of which I am not a member), but in case other people read this.
         public static final void main(final String[] args) {
              final MemoryMXBean mx = ManagementFactory.getMemoryMXBean();
              final File imageFile = new File("D:\\TEMP\\test1.jpg");
              printUsedMem(mx);
              Image image = Toolkit.getDefaultToolkit().createImage(
                      imageFile.getAbsolutePath());
              printUsedMem(mx);
              image = null;
              printUsedMem(mx);
         }OK, so you load a single image into memory, and think that it should be garbage collected after calling System.gc(). As other posters have pointed out, this isn't guaranteed to collect garbage, but it is likely.
    This prints :
    149728
    221144
    221144
    The last line should be the same as the first one !Why?
    I can think of a number of reasons why it wouldn't be, the most obvious being that your first line is printed before either the Image or Toolkit classes get loaded. Since Toolkit maintains a lot of in-memory data, it's likely that you're seeing constant overhead that won't be eligible for collection.
    If you want to write a real test, you need to put in a loop, to simulate actual image loading by an application. Ten times should be sufficient: if the memory increases by a constant each time, then you might have found an issue.
    Alternatively, you could use a profiler and see exactly what memory is being held, and by whom.
    I'm using jdk 1.5.0_11, on a Windows platform. I found people having the same problem, and the bug is referenced in your database and known for 12 years.
    Bug ID : #4014323
    Link : http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4014323
    That bug has absolutely nothing to do with your problem. And it was fixed in 1999.

  • How to deal with Memory Leaks, that are caused by Binding

    Hi, I recently noticed (huge?) memory leaks in my application and suspect bindings to be the cause of all the evil.
    I made a little test case, which confirms my suspicion:
    import javafx.application.Application;
    import javafx.beans.property.SimpleStringProperty;
    import javafx.beans.property.StringProperty;
    import javafx.scene.Scene;
    import javafx.scene.control.Button;
    import javafx.scene.layout.VBox;
    import javafx.stage.Stage;
    public class TestAppMemoryLeak extends Application {
        public static void main(String[] args) {
            launch(args);
        @Override
        public void start(Stage stage) throws Exception {
            VBox root = new VBox();
            Button button = null;
            for (int i = 0; i < 100000; i++) {
                button = new Button();
                button.textProperty().bind(text);
                button.textProperty().unbind(); // if you don't call this, you can notice the increased memory of the java process.
            root.getChildren().add(button);
            Scene scene = new Scene(root);
            stage.setScene(scene);
            stage.show();
        private StringProperty text = new SimpleStringProperty("test");
    }Now the problem is, HOW can I know, when a variable is no longer needed or overwritten by a new instance.
    Just an example:
    I have a ListView with a Cell Factory. In the updateItem method, I add a ContextMenu. The textProperty of each MenuItem is bound to a kind of global property, like in the example above. I have to do it in the updateItem method, since the ContextMenu differs depending on the item.
    So every time the updateItem method is called a new ContextMenu is created, which binds some properties, but the old context menus remain in memory.
    I guess there could be many more example.
    How can I deal with it?

    I've dealt with this situation and created a Jira issue for it, but I also have a work-around that is a bit unwieldy but works. I'll share it with you.
    The bug that deals with this (in part atleast): http://javafx-jira.kenai.com/browse/RT-20616
    The solution is to use weak invalidation listeners, however they are a bit of a pain to use as you cannot do it with something simplistic as "bindWeakly"... and you need to keep a reference around to the wrapped listener otherwise it will just get garbage collected immediately (as it is only weakly referenced). Some very odd bugs can surface if weak listeners disappear randomly because you forgot to reference them :)
    Anyway, see this code below, it shows you some code that is called from a TreeCell's updateItem method (I've wrapped it in some more layers in my program, but it is essentially the same as an updateItem method):
    public class EpisodeCell extends DuoLineCell implements MediaNodeCell {
      private final WeakBinder binder = new WeakBinder();
      @Override
      public void configureCell(MediaNode mediaNode) {
        MediaItem item = mediaNode.getMediaItem();
        StringBinding episodeRange = MapBindings.selectString(mediaNode.dataMapProperty(), Episode.class, "episodeRange");
        binder.unbindAll();
        binder.bind(titleProperty(), MapBindings.selectString(mediaNode.dataMapProperty(), Media.class, "title"));
        binder.bind(ratingProperty(), MapBindings.selectDouble(mediaNode.dataMapProperty(), Media.class, "rating").divide(10));
        binder.bind(extraInfoProperty(), Bindings.when(episodeRange.isNull()).then(new SimpleStringProperty("Special")).otherwise(episodeRange));
        binder.bind(viewedProperty(), item.viewedProperty());
        subtitleProperty().set("");
    }This code makes use of a class called WeakBinder -- it is a helper class that can make Weak bindings and can keep track of them. When you call unbindAll() on it, all of the bindings it created before are released immediately (although they will also disappear when the Cell itself is garbage collected, which is possible because it only makes weak references).
    I've tested this extensively and it solves the problem of Cells keeping references to objects with much longer life cycles (in my case, the MediaNode passed in has a longer lifecycle than the cells and so it is important to bind weakly to it). Before this would create huge memory leaks (crashing my program within a minute if you kept refreshing the Tree)... now it survives hours atleast and the Heap usage stays in a fixed range which means it is correctly able to collect all garbage).
    The code for WeakBinder is below (you can consider it public domain, so use it as you see fit, or write your own):
    package hs.mediasystem.util;
    import java.util.ArrayList;
    import java.util.HashMap;
    import java.util.List;
    import java.util.Map;
    import javafx.beans.InvalidationListener;
    import javafx.beans.Observable;
    import javafx.beans.WeakInvalidationListener;
    import javafx.beans.property.Property;
    import javafx.beans.value.ObservableValue;
    public class WeakBinder {
      private final List<Object> hardRefs = new ArrayList<>();
      private final Map<ObservableValue<?>, WeakInvalidationListener> listeners = new HashMap<>();
      public void unbindAll() {
        for(ObservableValue<?> observableValue : listeners.keySet()) {
          observableValue.removeListener(listeners.get(observableValue));
        hardRefs.clear();
        listeners.clear();
      public <T> void bind(final Property<T> property, final ObservableValue<? extends T> dest) {
        InvalidationListener invalidationListener = new InvalidationListener() {
          @Override
          public void invalidated(Observable observable) {
            property.setValue(dest.getValue());
        WeakInvalidationListener weakInvalidationListener = new WeakInvalidationListener(invalidationListener);
        listeners.put(dest, weakInvalidationListener);
        dest.addListener(weakInvalidationListener);
        property.setValue(dest.getValue());
        hardRefs.add(dest);
        hardRefs.add(invalidationListener);
    }Let me know if this solves your problem.

  • Oracle JDBC Thin Driver Memory leak in scrollable result set

    Hi,
    I am using oracle 8.1.7 with oracle thin jdbc driver (classes12.zip) with jre 1.2.2. When I try to use the scrollable resultset and fetch records with the default fetch size, I run into memory leaks. When the records fetched are large(10000 records) over a period of access I get "outofmemory" error because of the leak. There is no use increasing the heap size as the leak is anyhow there.
    I tried using optimizeit and found there is a huge amout of memory leak for each execution of scrollable resultsets and this memory leak is propotional to the no of records fetched. This memory leak is not released even when i set the resultset,statement objects to null. Also when i use methods like scrollabelresultset.last() this memory leak increases.
    So is this a problem with the driver or i am doing some wrong.
    If some of you can help me with a solution to solve this it would be of help. If needed i can provide some statistics of these memory leaks using optimize it and share the code.
    Thanks
    Rajesh

    This thread is ancient and the original was about the 8.1.7 drivers. Please start a new thread. Be sure to include driver and database versions, stack traces, sample code and why you think there is a memory leak.
    Douglas

  • Memory leak when redirecting to a remote XFree86 server

    Hi,
    I'm running a Java application, which controlls our network equipment.
    The application is written by our development team. It installs a graphical
    user frontend in order to allow interoperation with the network administrators.
    The application is run using the following environments:
    * Windows NT 4.0
    * Sun Solaris 8, local Xsun X11 server
    * Sun Solaris 8, XFree86 X11 server located on a linux host
    * Sun Solaris 8, CygWin/XFree86 X11 server running on a Windows NT host
    It turns out, that the application runs fine, if the application and the GUI either
    run both on a Windows NT host or the Sun workstation. However, if the application
    is launched on a Sun workstation and the X display is redirected to any XFree86
    X11 server, each change of the GUI focus - either forced by a mouse-click, or
    an canvas being changed by the application itsself - consumes an amount of
    3 MB of memory and never releases this again.
    So I suppose any memory leak in the Swing/X11 interface ...
    I've already searched SunSolve and installed all patches addressing memory leaks
    in Solaris 8 and Xsun ...
    Also our development team already has profiled the application using tools
    like OptimizeIt without being able to locate any memory leak.
    Has anyboday seen this before? Is there any bugfix/workaround available?
    Thx in advance,
    Jens Hamisch

    We just noticed the same problem for our Swing Applet using JDK 1.4 on Solaris 8 displayed to any remote X server running on Windows 2000 or Linux. If we let the applet run long enough (the plot in the applet updated every second), we could easily use up 500-600 Mb. Again, on the local console on Solaris or Windows 2000 the memory was stable at around 70 Mb.

  • What about the memory leak Bug in foreach tag

    Hi,
    does anybody knows if this bug is resolved already ?
    http://issues.apache.org/bugzilla/show_bug.cgi?id=25623.
    I see memory leaks in our application, and deeper check with YourKit profiler show that the objects retained in the jstl tags?
    Any help?

    Thanks for the info.
    The bug is in 'WONT FIX' status which is a shame.
    ram.

  • WARNING TDMS memory leak in LV 2010

    Hopefully this will save someone the headache that I've been through the last couple of days.  I have a very large applicaiton that is running a final verification test on a production line.  In my testing I noticed a memory leak in the application and after 2 days of debug discovered that the TDMS logging is the culprit.  This is very disappointing since I am (I mean was) a huge fan of the TDMS file format and the LabVIEW functions.  The attached VI reproduces the leak by checking and unchecking the Memory Leak checkbox.  Its a bit ugly but I was just coping and pasting the sections from my application and trying to reproduce the issue.  Luckily for me in this particular application I was only writing to the TDMS log files so I was able to eliminate the problem by switching to the gTDMS versions of the write functions.  I found these referenced in another post about TDMS memory leak, but in that case the leak was caused by the indexing and the fact that the SAME file was continuously written too over a very long period.  As you can see in my case, a log file is opened and closed for each "Test".
    gTDMS link
    Thanks,
    Brian
    Brian Gangloff
    DataAct Incorporated
    Attachments:
    TDMS Memory testing.vi ‏31 KB

    YongqingYe wrote:
    Hi Brian,
    I'm one of the developers of TDMS in NI R&D. Well, this is a problem of TDMS which has been complained by some customers. The reason you see the "memory leak" or the memory usage increment is because TDMS needs to bookkeep some information in memory and when you writing more and more data values, the information we keep in memory will keep increasing.
    There are some workarounds, gTDMS probably is also one of them, but the original purpose of creating gTDMS is to support writing TDMSs on Linux, Mac and other platforms:
    Using "NI_MinimumBufferSize" propertie on channels, you can find the details of the help documentation of TDMS Set Property. It can not eliminate this problem, but would reduce the memory usage significantly. Normally we would set it as 1,000 to 10,000.
    From LV 2009, if you writing to the file always with the same layout, like same channels same number of data values, you will not have memory increament.
    If you are using LV 2010 and later, you can try to play with TDMS Advanced API, this API will not have any memory increasing problem at all.
    Thank you!
    Yongqing Ye
    NI R&D
    Hello Yongqing,
    Apparently you did not bother to look at the examples that I provided or read any of the description either.  As Hooovahh has already pointed out, INDEXING is NOT the issue.  The example writes an array to multiple channels ONE time and then the reference is CLOSED.  In the case that does NOT leak, there are multiple waveform arrays written to the file which would require some indexing but the memory does NOT increase.  The problem is when an array of strings is written to multiple channels and the reference is CLOSED.  Unfortunately this type of quick assumption about the problem is why the real issue was overlooked back in 2009.
    Thanks,
    Brian
    Brian Gangloff
    DataAct Incorporated

Maybe you are looking for