Finding Process Memory Leak?

I have been tracking down memory leaks in a Java server-based application. I recently ran the application for several hours, and monitored memory usage with both JConsole and the Unix �top� command. I encountered some behaviors that I don�t understand.
With JConsole, I observed that the heap memory usage was fairly constant over time. The Code Cache space, however, gradually increased in size over the life of the test. I expected some increase as additional methods in the application were executed, but it seems that eventually the rate of increase would level out. It did not. Any ideas why that might happen?
The resident memory (as reported by top) increased significantly over the life of the test. Using pmap and jmap, I was able to determine that the heap space was increasing (even though JConsole reported that the heap was constant.) So, it seems as though the heap usage of the application is constant, but the heap usage of the process is still growing? I am using Java HotSpot VM for Solaris (1.6.0-b105).
Any suggestions or insight would be appreciated.

I'm not sure exactly what you're saying, but it sounds like this:
A tool that's monitoring the VM says the memory used by your objects is not increasing, but other tools say the memory the VM has taken from the OS is increasing.
Is that the case? If not, nevermind--I've misunderstood.
If that is the case, then it's totally expected. The VM doesn't usually give memory back to the OS. If it hasn't used up the amount specified by -Xmx (or the default if you didn't specify -Xmx), it's free to just keep grabbing memory from the OS, rather than running a full GC to reclaim memory that it has used for objects but that is no longer reachable.

Similar Messages

  • Can't find the memory leak in Managed Object

    Hey guys...I am trying to find the memory leak that Instruments says I have in this section of code setting up a managed object:
    oCurrentSection = (Section*) [NSEntityDescription insertNewObjectForEntityForName:@"Section" inManagedObjectContext:[[CoreDataManager sharedData] oManagedObjectContext]];
    oCurrentSection.nsSectionName = [attributeDict objectForKey:@"name"];
    oCurrentSection.nsImgUrl = [attributeDict objectForKey:@"imgURL"];
    oCurrentSection.nsDesc = [attributeDict objectForKey:@"desc"];
    oCurrentSection.iOrder = [NSNumber numberWithInt: [[attributeDict objectForKey:@"order"] intValue]];
    Can anyone help me out?

    Thanks everyone! That makes a lot more sense. Yes, kjon, I do come from windows. But please don't reference my troubled past. Actually, I typically use "ps aux | sort -n +3 | tail -1" rather than simply "ps aux" - I just wanted to make sure I wasn't missing something by looking at only the top memory-user. Glad to know there's no massive memory leak in my system
    Procyon, what's wrong with a huge swap? Wouldn't you do it too if you were given a system with 200GB hdd more than necessary and told to make a webserver?
    [root@norpass ~]# df -H
    Filesystem Size Used Avail Use% Mounted on
    /dev/sda3 7.9G 1.1G 6.8G 14% /
    none 1.1G 0 1.1G 0% /dev/shm
    /dev/sda1 40M 9.9M 28M 27% /boot
    /dev/sda4 238G 4.5G 234G 2% /home

  • Safari web process - memory leak?

    Mac Pro seemed to have slowed to a crawl.
    Safari 5.1.2 on SL 10.6.8
    Activity Monitor showed I was low on memory - over 7GB was being used by 'safari web process' - slowly close all open pages until only left with two - one was simply the 'bing' home page, the other a page that had failed to load.
    Anyone else had this kind of thing recently?

    Safari has a known memory leak. Open teh Activity Monitor, sort the list of apps by Real Memory column. You will find one called Safari Web Content. This is the cause. If you are running an safari extensions, they use SWafari Web Content to run, you can try turning off your extensions to see if that helps. About the only know fix now, is to close safari regularly. 5.1.2 was suppose to close some leaks but has not. There are reports you can run safari in 32bit mode but I haven't confirmed if this helps or not.

  • Secd Process Memory Leak

    Finding the secd process using 13GB of RAM was a bit of a shock. Watching its RAM consumption continue to increase, indicates a memory leak. Is this something anyone else has noticed? And any possible solutions?

    Thanks - I think this helped, but will give it a day or two to see what happens.
    My secd was over 32 GB the other day and the iMac wasn't quite its usual self. After restarting, secd's memory usage dropped away, but has been steadily creeping up over the last couple of days and was over 5GB this morning. So I tried dragging the Keychains folder to the trash and restarting.
    The thing about dragging your keychain to the trash and restarting is, on logging back in you may be asked for a pile of passwords to all your mail accounts and your keychain will be empty!
    I filled out all the requests for icloud passwords, but for the keychain to update properly, this took a while. I think what saved me from panicking about losing all my passwords, was going into System Preferences and signing into iCloud there. I was also requested to verify my iCloud login from another device (e.g., iPAD). I think this is what restored my keychain from the cloud.
    Once the keychain had updated itself, I restarted the iMac again, and Mail returned to normal (no more requests for mail account passwords).
    The only thing that wasn't restored after restarting was automatic keychain access to my time machine. I had to enter the password and save it to the keychain.

  • Process memory leak issue  solaris 10

    I have a process which has a memory leak issue. I ran this process on solaris 9 as well as solaris 10. When i run prstat command i get a different output for two. Funny thing is that memory leak noted in solaris 10 is much more than that in solaris 9 e.g if it is 1 MB in solaris 9 then its 4 MB in solaris 10.
    What can be possibly causing this ? Is this related to kernel implementation on diff solaris ?

    I have a process which has a memory leak issue. I ran this process on solaris 9 as well as solaris 10. When i run prstat command i get a different output for two. Funny thing is that memory leak noted in solaris 10 is much more than that in solaris 9 e.g if it is 1 MB in solaris 9 then its 4 MB in solaris 10.
    What can be possibly causing this ? Is this related to kernel implementation on diff solaris ?

  • After 10.8.4....imagent process memory leak

    I upgraded my MBA to 10.8.4.  I started getting messages that my startup memory was full.  I take a peak at Activity monitor and "imagent" is using 6GB of RAM and my HD has dropped in available space almost 100GB!!!
    I force quit the process and reboot to recover the space soaked up by the leak, but it keeps coming back.  As soon as I hear my fans going crazy I look at activity monitor and yep its back again.
    Any one else with this issue after 10.8.4?  I see in the release notes it was supposed to fix the reording of the messages in "imagent" but at this point I'll take the reorder problem over this problem.

    Please read this whole message before doing anything.
    This procedure is a diagnostic test. It’s unlikely to solve your problem. Don’t be disappointed when you find that nothing has changed after you complete it.
    The purpose of the test is to determine whether the problem is caused by third-party software that loads automatically at startup or login, or by a peripheral device. 
    Disconnect all wired peripherals except those needed for the test, and remove all aftermarket expansion cards. Boot in safe mode and log in to the account with the problem. Note: If FileVault is enabled, or if a firmware password is set, or if the boot volume is a software RAID, you can’t do this. Ask for further instructions.
    Safe mode is much slower to boot and run than normal, and some things won’t work at all, including Wi-Fi on certain iMacs. The next normal boot may also be somewhat slow.
    The login screen appears even if you usually log in automatically. You must know your login password in order to log in. If you’ve forgotten the password, you will need to reset it before you begin. Test while in safe mode. Same problem? After testing, reboot as usual (i.e., not in safe mode) and verify that you still have the problem. Post the results of the test.

  • Imagent process memory leak

    Hi all,
    Since using a beta a couple of times I've noticed that imagent has gone nuts and started swapping insanely. I have about 30Gb free on my system drive, and it will chew through it all in a matter of minutes, then bring the whole computer to it's knees.
    If I catch it in time and kill the process I loose that diskspace to vmswap files, but will get it back on reboot, and I can keep using the computer. If not, I have to hard reboot.
    Using 10.7.3, and the Messages Beta. I have a yahoo, AIM, and iMessage accounts.
    Also, since killing off the imagent process and it going nuts, even after a restart of the Messages app, I can't iMessage people.
    Anyone else seen any odd behaviour?
    Regards,
    Alex

    I also had Messages fail to deliver after killing imagent, and even after rebooting. Turns out in my case Messages had mysteriously switched to locating my contacts by email address rather than cell number. Switching contacts back to number made Message app resend failed messages successfully.

  • Finding Memory Leak in LabVIEW

    Hi NG,
    we wrote a sort of hugh application in labview that collaborates with our
    ..NET driven
    device framework and a variaty of unmanged c++ libs.
    As we are now close to the release we did performance testing and it showed
    up that
    the app is consuming more memory continously.
    We used prefomance counter to check whether the managed objects might not
    get garbage collected
    but this is done OK, since the handle count stays at a constant level.
    We tried to figure out whether one of the c++ libs is causing the problem
    but this is not the case either, since
    the memory leak exists even if the lib functions are just not being called.
    Even labview profiler is not detecting any inconvenient memory consumption
    of any of our vis but
    windows task manager notices a constant memory consumtion of the executable
    (or of labview.exe itselve when running in
    dev. environment).
    Does anybody know what this might be? Has anybody a clue what other tools we
    could use to figure out
    where the problem is?
    Any help is greatly appreciated.
    Thanks in advance, Sebastian Dau!

    "mfitzsimons" <[email protected]> wrote in message
    news:[email protected]..
    > Sebastian,
    > Memory leaks can be VERY hard to find.&nbsp; I use the divide and conquer
    > technique that involves chunking (make into smaller code segments) your
    > code into smaller pieces and running the smaller pieces until you find the
    > memory leak.&nbsp; It can take weeks to find the source.
    you accelerate this process by using the labview profiler.
    > The most common is arrays or any data that increases in size as the
    > program runs.&nbsp; To fix this you can use a FIFO that allows only so
    > many elements to be added before deleting data out of the array.&nbsp; The
    > second source is opening references repeatedly and not closing them.&nbsp;
    > Look closely at any VI that open anything.&nbsp; Do a search for "Memory
    > Leak" on the discussion forum and you will find about 60 postings that may
    > help.&nbsp;
    > Matt
    > If you are using DAQ-MX <a
    > href="http://digital.ni.com/public.nsf/allkb/BAF29EE03747EE4B86256E9700541436?OpenDocument"
    > target="_blank">http://digital.ni.com/public.nsf/allkb/BAF29EE03747EE4B86256E9700541436?OpenDocument</a>
    > &nbsp;
    >
    arrays and refs have already been checked.
    thanks, Sebastian

  • Finding Memory Leak

    Is it possible to find the memory leak using the following command
    java -Xprof <classname>Regards
    ackumar

    Here is the output for one of my class. I didn't use any "java.net" class in my code.
    But it shows java.net.SocketInputStream.socketRead() is interpreted 50.0%
    I am in bit confusion . So plz help me.
    Flat profile of 93.41 secs (4041 total ticks): main
      Interpreted + native   Method
    50.0%     0  +  2012    java.net.SocketInputStream.socketRead0
      0.0%     0  +     1    java.lang.ClassLoader$NativeLibrary.load
      0.0%     0  +     1    java.net.SocketOutputStream.socketWrite0
      0.0%     0  +     1    java.lang.ClassLoader.defineClass0
      0.0%     0  +     1    sun.misc.URLClassPath$7.getInputStream
      0.0%     0  +     1    com.mysql.jdbc.SingleByteCharsetConverter.<clinit>
      0.0%     0  +     1    com.mysql.jdbc.MysqlIO.checkErrorPacket
      0.0%     0  +     1    com.mysql.jdbc.Connection.<init>
    50.2%     0  +  2019    Total interpreted
         Compiled + native   Method
      0.4%    15  +     0    cern.colt.matrix.impl.DenseDoubleMatrix2D.zMult
      0.2%     7  +     0    java.lang.FloatingDecimal.readJavaFormatString
      0.1%     4  +     0    com.mysql.jdbc.ResultSet.getString
      0.1%     0  +     3    java.lang.String.<init>
      0.1%     3  +     0    com.mysql.jdbc.SingleByteCharsetConverter.toString
      0.0%     2  +     0    cern.colt.matrix.impl.DenseDoubleMatrix2D.getQuick
      0.0%     2  +     0    com.mysql.jdbc.Buffer.readFieldLength
      0.0%     0  +     2    java.io.BufferedInputStream.read1
      0.0%     1  +     1    java.lang.FloatingDecimal.doubleValue
      0.0%     2  +     0    java.lang.Integer.parseInt
      0.0%     1  +     0    java.util.ArrayList.get
      0.0%     1  +     0    java.util.HashMap.hash
      0.0%     1  +     0    com.mysql.jdbc.MysqlIO.readFully
      0.0%     1  +     0    com.mysql.jdbc.Connection.getCharsetConverter
      0.0%     1  +     0    com.mysql.jdbc.ResultSet.getInt
      0.0%     1  +     0    cern.colt.matrix.impl.DenseDoubleMatrix1D.assign
      1.2%    42  +     6    Total compiled
             Stub + native   Method
    48.3%     0  +  1943    java.net.SocketInputStream.socketRead0
    48.3%     0  +  1943    Total stub
      Thread-local ticks:
      0.4%    18             Blocked (of total)
      0.0%     2             Interpreter
      0.3%    11             Compilation
    Flat profile of 0.01 secs (1 total ticks): DestroyJavaVM
      Thread-local ticks:
    100.0%     1             Blocked (of total)
    Global summary of 93.43 seconds:
    100.0%  4127             Received ticks
      2.1%    85             Received GC ticks
      0.0%     2             Interpreter

  • Finding Memory leaks in C using Visual Studio 2013

    I am using Visual Studio 2013, and taking a course in C programming and we started
    talking about memory bugs detaction, in particular memory leaks, and how to detect them using Valgrind on Linux.
    I want to know if there is a way to detect such memory leaks using VS 2013. I tried searching online but it just leads to lots of articles and blogs and msdn posts and blogs with lots of words like dump files, and analyzing them, etc which is weird
    because:
    1) It sounds so complex, convoluted and unintuitive it is actually hard to comprehend it.
    2) The main reason this is weird is due to the fact that VS is the most advanced IDE around and Microsoft spends so much money on in, yet from what I have read it seems that there is no simple way to use VS to detect memory leaks
    - certainly no way that's as simple as Valgrind where I only have to compile the program and run the command valgrind -leaks-check=yes ProgramName
    and it simply prints to me all location it thinks there is a memory leak and describes the error (like not freeing memory after allocating it with malloc hence having "dead" memory after the program finishes, or accessing memory that's out of
    the array bounds)                                                                                                                                                               
    So my question is how to use VS 2013 in order to achieve the same results and to find out First in high level if there are memory leaks in the program, and Second - to detect in a simple manner where those leaks are- preferably without involving dump files
    (not that I know how to use them anyway in VS).

    Hi MicrosoftLaw,
    Thanks for your post.
    Based on your issue, if you want to check if there are memory leaks in the C program from this VS2013. I suggest you could try to find Memory Leaks Using the CRT Library, for more information:
    https://msdn.microsoft.com/en-us/library/x98tx3cf.aspx?f=255&MSPPError=-2147217396
    In addition, I find a similar thread about this issue, please you refer the Dusty's suggestion to check this issue.
    http://stackoverflow.com/questions/45627/how-do-you-detect-avoid-memory-leaks-in-your-unmanaged-code
    I did some research about this issue, I found that the Visual Leak Detector extension tool is a free, robust, open-source memory leak detection system for Visual C++. So if possible, I suggest you could try to use the Visual Leak Detector extension
    tool to find the memory leak for Visual C/ C++ program.
    https://visualstudiogallery.msdn.microsoft.com/7c40a5d8-dd35-4019-a2af-cb1403f5939c
    However, if you have any issue about how to use this Visual Leak Detector extension tool to find the memory leak for C program. I suggest you could directly to write a review to this REVIEW tab in Visual Leak Detector site.
    Best Regards,
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Memory leaks with Third party classes

    Hello all,
    This is fairly known problem. But I guess, my problem gives a new dimention to the problem.
    I have an application which is developed by me. This application ideally needed to use third party classes ( obviously no source code is supplied ). These third party classes provide extra functionality required.
    The problem is, when I don't use third party classes in my application, every thing is fine. When I include third party classes, I am having memory leaks.
    Then I tried to investigate memory leaks with Optimizeit tool. It is new to me. As of now, I understood, we can identify where the memory leaks are occuring.
    finally the problem is, in order to solve this, I need some patches in the code. But I don't have source code for those classes. How to solve this problem?
    For example,
    I use a third party classes in my code like this,
    ThirdPartyMemoryLeakClass obj = new ThirdPartyMemoryLeakClass();
    This 'obj' is made static, as it takes lot of time to create this object. Obviously this object contains several references to other objects, which I can't control.
    In the process of reusing this object, I am getting memory leaks.
    Any ideas regarding, how one has to deal this type of situations? What are the issues involved with this case? Are there any similar problems, which have been solved? are most welcome.
    many thanks for your time.
    Madhav

    Decompile it using jad. Find leak.Yes, I too got the idea and tried to decompile those classes and recompile. I had some problems while recompiling. Is this is the only way to get rid of this problem?
    I was refering to powersoft.datawindow.DataStore class. Does any body here has worked on these?
    Can you suggest me how to find the memory leak causes? if you were needed to find out memory leak causes, what would be your approach?
    Madhav

  • Memory leak with multi-threaded environment

    When starting an environment with the THREADED_MUTEXED
    or THREADED_UNMUTEXED mode parameter, the oracle OCCI API
    has a memory leak. This can be demonstrated by modifying
    the "occidml.cpp" demo program as follows:
    Replace line 26:
    env = Environment::createEnvironment (Environment::DEFAULT);
    with
    env = Environment::createEnvironment (Environment::THREADED_MUTEXED);
    And replace line 164:
    demo->displayAllRows();
    with
    for (int ii=0; ii<10000; ii++) demo->displayAllRows();
    Recompile and run the program, and use "top" to see the
    size of the process's used memory continually increase
    unbounded.
    I am using the Oracle 9.2.0.1.0 database on Linux,
    gcc version 2.96.
    Is anyone aware of a fix for this problem?

    Yeah, I did suffer from this.
    If possible , you can switch to using OCCI on Oracle 10G client , you will find no memory leak issue anymore.
    Another issue is that OCCI is using default connection-blocking implementation , if a DB connection is blocked by accident just like plugging out the network link, you can not get any timeout or connection closed indications. You must implement your own OCCI connection timeout strategy, and you must kill the thread/process you are using.

  • Memory leak in Servlet Filter handling?

    In Sun Web Server 6.1, I'm finding a memory leak when using servlet filters. I've even created a "no op" servlet filter. When it's registered, every 10000 hits or so to filtered static content will eat up about 5 to 10 MB of RAM. The JVM heap size doesn't increase.
    When I remove the filter, I've hit the same static page on the server 50000 times without seeing an increase in memory usage by the process.
    This is on Windows 2000, and I think the Sun Web Server 6.1 is SP1. I haven't tried SP2 yet.
    For reference, here's the filter I put in:
    public class NoOpFilter implements Filter
    public void init(FilterConfig arg0) throws ServletException {}
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException
    chain.doFilter(request, response);
    public void destroy() {}
    }

    I found the bug. I get the memory leak if magnus.conf has either or both of the following entries:
    AdminLanguage en
    DefaultLanguage en
    If I delete the entries, the memory leak goes away. I suppose this should get fixed by Sun sometime. Maybe I'll figure out how to officially report the bug later.

  • Check memory leak using sun studio 10

    Hi,
    I'm using sun studio 10 to find the memory leak. I pre loaded the librtc.so and attached the process. Then I set the break point at the beginning of scenairo and the end of scenario. Then I trigger the event and program flow hits the break point at the beginning of scenairo, I try to enable the "Memory Check". Then I continue my application. But, I don't see anything show up in the "memory check" tab in the debug window.
    Is anyone there who know what is the problem here? Appreciate your help.
    Li

    Can you help mi. Novice
    mail [email protected]

  • How to detect a memory leak?

    Hi,
    we are running a web application with Tomcat 4.1.27 on HP-UX 11i under HP-JVM 1.4.2_05.
    We have major problem, that the application suddenly starts to allocated the whole memory (6GB) and the server stops running because the JVM is busy doing GCs. We don`t get an out of memory exception, but after 300sec or more doing major-gc, only about 100mb memory is freed, which is allocated again very very fast.
    I tried -verbosegc and the application was profiled with jprobe on hp-ux environmen tand with optimizeit on windows environment. With the profling tools we didn`t find any memory leaks. We even used verbosegc in production environment, the server runs fine for days spending about 0.09 seks for minor GCs and it allocates about 1gb(256m for Eden) of 6gb. But suddenly the server starts to do minor gcs about 2 to 4 seks and after a few minutes the whole memory is allocated and the vm is busy doing major GCs. In the log-files, which are very detailed, we can`t find any coherency with the suddenly appearing GCs.
    Any approach to solve this problem?

    I`ve found it:
    I have to use -Xeprof with the following option:
    "time_on=sigusr1|sigusr2 (SDK 1.4.1 and later)
    Specifies which signal will cause profiling to begin (profile data collection). Please be aware that the application or the VM may already be using the sigusr signals for their own purposes; please check the documentation. Specifying a signal and a timeout (see above) at the same time is possible by repeating the time_on option. Only one of the two signals can be declared to use as the signal to start profiling. During the application's run, the specified signal can be delivered to the Java� process multiple times."
    But i have no idea how to define a signal which causes the profiling to begin.
    What is a sigusr signal? And how to specify this signal?
    Are these signals or Java or HP-UX?

Maybe you are looking for

  • Wat is the use of "DATA var-name LIKE SY-INDEX" statement

    Hi to all,        is there any use of "DATA <var-name> LIKE SY-INDEX"  statement in ABAP, do the variable <var-name> be changed with that of SY-INDEX when we declare like this.          Could u give me a fast response,                                

  • A Series of Unfortunate Events - Any Ideas and help appreciated!

    Four weeks ago, when performing some routine backups, I started to get error messages. Upon further research, I discovered my internal HD (Macintosh HD), was reporting an imminint failure. I started to use my external backup as my main HD until I cou

  • How to determine Image Location - JDev 11.1.2

    Hello: In a ADF Fusion app, when I drop an af:image on my page, Jdev asks if I want to copy the image to the project. Saying yes results in the image being copied to /ViewController/src/META-INF/resources/images directory and image source EL is #{res

  • Outlook Mail + Contact  + Calendar folders change after sync

    I use Outlook and after sync with my iPhone my Favorite Folder list changes. The Calendar and Contact folder names appear in Favorites (not there before) and cannot be deleted by right click and selecting "Remove from Favorite Folders". I found that

  • Unable to Launch Photoshop CS4

    I started having this problem 3 days ago. Suddenly one morning Photoshop CS4 stopped launching. The bad part is, there is no error message...nothing...it just won't launch. Other programs, including Bridge CS4 works fine, just Photoshop. I'm using Wi