How to detect "almost out of memory" in JRockit?

I would appreciate any advice on how to build an "almost out of memory" detector to ensure the JVM does not crash when the user mis-configures our application.
So far I have encountered these problems with JRockit 27.3 (JDK 5.0) in limited testing on windows. This test is just one part of the app, using only 50mb. I've tried 27.4 and it appears to have the same issues.
1) Runtime.freeMemory returns 0 often, even when lots of memory is still available (28% was returned in the previous call!). If the thread sleeps for 30 millisec a resonable value might be returned. (but still gets 0 fairly often).
2) There is huge oscillation in the free memory reported even when there is > 15% memory left. The test program allocates some intermediate data (10kb or so), then the more permanent data (500 bytes or so). Successive calls to free memory in the loop can oscillate from 8% left to 17% left.
3) As memory gets more than 50% used, the GC algorithm switches around several times. I was using -Xgcprio:pausetime with pause time of 600ms. The observation was the GC algorithm switches and some full GC's would take as much as 8 seconds (this test using 100mb of memory) and during this time my polling thread (250ms) does not run. This is a problem since there are a couple of polling threads that expect to run at least once per second.
4) It appears the basic Java heap usage is quite different with JRockit. The test code can allocate 50k result objects (about 500 bytes each) when run in Sun JVM, but only 33k objects in JRockit. (-Xmx is set to 50M for these tests, the real app runs with 3 to 12GB based on customer hardware)

Can you post your test code here?
Thanks,
/Staffan

Similar Messages

  • Almost out of memory

    hello I enclose a screenshot of my memory
    I am almost out of memory but I have no idea what takes so much space?
    Ofcourse I am talking about the 320 GB SATA disk, the other are allright
    you can see it is called other, how can I find out what it is?
    I first thought it was dropbox,as I downloaded a lot of files to dropbox, but I have desynced all my folders and I still get the same amount of space.
    The helpdesk of dropbox tells me that my mac cannot contain contents anymore if I have desynced the folders...
    I want to free my mac from this yellow stuff from which I do not know what it is. Has anybody an idea how I can figure this out?
    Txs,
    Marcel Steinbach

    For information about the Other category in the Storage display, see this support article.
    Empty the Trash if you haven't already done so. If you use iPhoto, empty its internal Trash first:
    iPhoto ▹ Empty Trash
    Do the same in other applications, such as Aperture, that have an internal Trash feature. Then reboot. That will temporarily free up some space.
    According to Apple documentation, you need at least 9 GB of available space on the startup volume (as shown in the Finder Info window) for normal operation. You also need enough space left over to allow for growth of the data. There is little or no performance advantage to having more available space than the minimum Apple recommends. Available storage space that you'll never use is wasted space.
    When Time Machine backs up a portable Mac, some of the free space will be used to make local snapshots, which are backup copies of recently deleted files. The space occupied by local snapshots is reported as available by the Finder, and should be considered as such. In the Storage display of System Information, local snapshots are shown asBackups. The snapshots are automatically deleted when they expire or when free space falls below a certain level. You ordinarily don't need to, and should not, delete local snapshots yourself. If you followed bad advice to disable local snapshots by running a shell command, you may have ended up with a lot of data in the Other category. Reboot and it should go away.
    See this support article for some simple ways to free up storage space.
    You can more effectively use a tool such as OmniDiskSweeper (ODS) to explore the volume and find out what's taking up the space. You can also delete files with it, but don't do that unless you're sure that you know what you're deleting and that all data is safely backed up. That means you have multiple backups, not just one.
    Deleting files inside an iPhoto or Aperture library will corrupt the library. Any changes to a photo library must be made from within the application that created it. The same goes for Mail files.
    Proceed further only if the problem isn't solved by the above steps.
    ODS can't see the whole filesystem when you run it just by double-clicking; it only sees files that you have permission to read. To see everything, you have to run it as root.
    Back up all data now.
    If you have more than one user account, make sure you're logged in as an administrator. The administrator account is the one that was created automatically when you first set up the computer.
    Install ODS in the Applications folder as usual. Quit it if it's running.
    Triple-click anywhere in the line of text below on this page to select it, then copy the selected text to the Clipboard by pressing the key combination command-C:
    sudo /Applications/OmniDiskSweeper.app/Contents/MacOS/OmniDiskSweeper
    Launch the built-in Terminal application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ Open LaunchPad. Click Utilities, then Terminal in the icon grid.
    Paste into the Terminal window (command-V). You'll be prompted for your login password, which won't be displayed when you type it. You may get a one-time warning to be careful. If you see a message that your username "is not in the sudoers file," then you're not logged in as an administrator.
    The application window will open, eventually showing all files in all folders, sorted by size with the largest at the top. It may take a few minutes for ODS to finish scanning.
    I don't recommend that you make a habit of doing this. Don't delete anything while running ODS as root. If something needs to be deleted, make sure you know what it is and how it got there, and then delete it by other, safer, means. When in doubt, leave it alone or ask for guidance.
    When you're done with ODS, quit it and also quit Terminal.

  • My MBA won't empty the trash and I'm almost out of memory. It's not a year old yet.

    My MBA won't empty the trash and I'm almost out of memory. It can't upgrade too! I just got it last august 2013.

    Mac troubleshooting: What to do when the Trash won’t empty | Macworld

  • How to cope with Out of Memory Errors

    Hi, I am distributing a desktop application to the general public written in Java 1.4.2. How much memory is required is approximately propertional to how many files they load so Ive tried to pre-emtp OutOfMemoryErrors by checking when memory usage is 95% and preventing the loading of additional files above this level with the following code:
    protected static void checkMemory()
            throws LowMemoryException
            if (Runtime.getRuntime().freeMemory() < Runtime.getRuntime().maxMemory() * 0.05)
                Runtime.getRuntime().gc();
                if (Runtime.getRuntime().freeMemory() < Runtime.getRuntime().maxMemory() * 0.05)
                    MainWindow.logger.severe("Memory low:" + Runtime.getRuntime().freeMemory() / 1024 / 1024 + "MB");
                    throw new LowMemoryException("Running out of memory");
        }but this code is not robust, sometimes users reports LowMemoryException when the user has only loaded a few files.
    I tried removing this code, but then user can get an OutOfMemory error whcih can cause problems with whatever code was running at the time and leave the application in an inconsistent state, if I just exit the application immediately it would be very annoying for users that are int he middle of something.
    I also have adjusted the -Xms and -Xmx settings but cannot decide on a suitable default.
    What I would ideally like the application to do is to extend its heap space as required upto the limits of the users machine, and if it reaches memory limits handle the lack of memory in a releiable manner allowing the user to continue using the application in a safe way

    Unfortunately the metadata is stored displayed within a JTable, so even if If I had in in a Database I think it would all have to be loaded into memory for display within the JTbale in a timely fashion.
    Anyway I think Ive found the problem with the original code, it was reporting memory low when almost all the allocated memory was being used but had'nt accounted for the fact that maxMemory limit had not been reached so more memory could be allocated.
    I think the correct code is:
    protected static void checkMemory()
            throws LowMemoryException
            if (Runtime.getRuntime().totalMemory()  -  Runtime.getRuntime().freeMemory() > Runtime.getRuntime().maxMemory() * 0.95)
                Runtime.getRuntime().gc();
                if (Runtime.getRuntime().totalMemory()  -  Runtime.getRuntime().freeMemory() >  Runtime.getRuntime().maxMemory() * 0.95)
                    MainWindow.logger.severe("Memory low:" + (Runtime.getRuntime().maxMemory()  - (Runtime.getRuntime().totalMemory()  - Runtime.getRuntime().freeMemory() ))/ 1024 / 1024 + "MB");
                    throw new LowMemoryException("Running out of memory");
        }

  • How can I trap Out- of-Memory data with no crash after Crop Tool fails to finish?

    The Photoshop 6 beta program froze while using the crop tool on an image size of 8052x5368. I tried to save a file in another program while waiting for the crop to finish (usually about 1 second) and got an out-of-memory error. I checked the D: driv where the file in the other program was saved. I have a flash C: drive and is not selected in the scratch disk preference. Two scratch disks, E: and G:, are selected with a total of about 800GB free space. After closing PS6Beta, the D: drive recovered about 164GB. The D: drive is not selected in the Scratch Disk list. I work with larger files and anticipate this problem again.How can I trap information for Adobe next time?
    Adobe Photoshop Version: 13.0 (13.0 20120305.m.415 2012/03/05:21:00:00) x32
    Operating System: Windows 7 64-bit
    Version: 6.1 Service Pack 1
    System architecture: Intel CPU Family:6, Model:14, Stepping:5 with MMX, SSE Integer, SSE FP, SSE2, SSE3, SSE4.1, SSE4.2, HyperThreading
    Physical processor count: 4
    Logical processor count: 8
    Processor speed: 2664 MHz
    Built-in memory: 16375 MB
    Free memory: 13523 MB
    Memory available to Photoshop: 3255 MB
    Memory used by Photoshop: 60 %
    Image tile size: 128K

    The problem remains for how the c: and d: drives were not selected in the scratch disk list. I tried again with only E: and G: drives and the file completed after 20 minutes with a 27.7G file. It would have been an ovious problem if the "info" diaglog box included the projected file size and/or dimensional units (px or in) because I use the dialog for verifying the size of the image. I wanted to make a 300 x400px image rather than a 300x400inch image( 90000x120000px).
    Thanks for your quick help.

  • How can I solve out of memory error on excell file in PL/SQL

    Hi,
    I'm new on PL/SQL. One of the PL/SQL code which is created excell report got out of Memory error. The first reason of this error, excell file not supported more than 65536 data. So I change the excell file separeted sheets. So that the single sheet size cannot exceed 65536 data.
    All the data are held on system cach and if many user want to take the report the they would get an out of memory error.
    So I want to change the code like that; when out of memory exception raises,
    the old excell file save to disk and new excell file is created,
    and go on to write the new file without exiting the program.
    At the end of the data all the excell file append and show only one file to the user.
    I do know how to save the file and create a new file. But I don't know how can PL/SQL program to turn back to loop again when the exception occurs.
    Is anyone help me on this issue?
    Here is my code
    Thank you
    dworkbook:=hssfworkbook.new;
    dCurrentItem := Get_Block_Property(pCurrentBlock, FIRST_ITEM);     
    while not (name_in('system.last_record')='TRUE') loop
    /* The data would be written to the excell file column order. */
    if (dRow=0) then
              /* Create a new sheet */
    elsif (dRow <= dMaxWorksheetNum) then
         /* Data of the report are written here. The data are written in column order */
    if (dRow > dMaxWorksheetNum) then
         /* give dRow and dColumn intial value */
    /* increase worksheet number */
    end if; /* End of if (dRow=1) */
    if (isWritten) and not name_in('system.last_record')='TRUE'then
         /* if not at the end of the record and the previously read record is written to the file
         , then go to next record */
         next_record;
    end if;
    /* save excell report */
    workbookwriter.save(dworkbook,global.gethome||dFileName);
    web.show_document('/users/'||dFileName,'_BLANK');
    /* when exceptions occurs */
    EXCEPTION
    WHEN ORA_JAVA.EXCEPTION_THROWN THEN
    begin
         javaException := ORA_JAVA.LAST_EXCEPTION;
         -- Print out the Exception by using the toString()
         -- Method of the exception Object
         javaException2 := Exception_.new(javaException);
         mess(27002,Exception_.getMessage(javaException2));
         -- and clean up
         ORA_JAVA.CLEAR_EXCEPTION;
    exception
         WHEN ORA_JAVA.JAVA_ERROR THEN
    -- In this case, the error would be
    -- Argument 1 can not be null
    mess(27002,ORA_JAVA.LAST_ERROR);
    --Clean up
    ORA_JAVA.CLEAR_ERROR;
    end;
    WHEN ORA_JAVA.JAVA_ERROR THEN
    -- In this case, the error would be
    -- Argument 1 can not be null
    message(ORA_JAVA.LAST_ERROR);
    --Clean up
    ORA_JAVA.CLEAR_ERROR;

    No need to double-post... most questions are answered pretty quickly...

  • How to fixe exception out of memory ?

    Hello,i did a web application (asp.net/c#/crystal reports),i used more than 35 tableAdapter and when i'm trying report after some time i remark the memory increase more and more until i get Out Put memory Exception. how can i fix this problem ?
    please help me

    Hi ghilasdz,
    Thank you for posting in MSDN forum.
    Since this forum is to discuss: Visual Studio WPF/SL Designer, Visual Studio Guidance Automation Toolkit, Developer Documentation and Help System, and Visual Studio Editor.
    So I’m afraid that it is not the correct forum for this issue.
    As you said that the exception out of memory for the crystal reports, I suggest you can post this issue directly to the
    SAP Crystal Reports: http://scn.sap.com/community/crystal-reports/content?filterID=contentstatus%5bpublished%5d~objecttype~objecttype%5bthread%5d
    , you will get better support for this issue.
    In addition, I find a similar thread about the exception out of memory for the crystal reports on the
    SAP Crystal Reports, maybe you will get some useful message.
    http://scn.sap.com/thread/1888746
    Thanks for your understanding.
    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.

  • MacBook almost out of memory

    When I check my MacBook's memory, I have 45BG of memory used by "Other" how can I figure out what all of that is and get rid of the junk... I've deleted cache and documents I don't need, but I really don't have that much "stuff".

    You'll find some good information here:
    http://pondini.org/OSX/DiskSpace.html
    FWIW, what you referred to as memory is really space on your hard drive; I know that's a little confusing.

  • IPhone 4 almost out of memory but how to clean up

    The iPhone 4 say i have 8,2GB programs/apps but I have 11 programs 124MB programs what can I do to get 8,1 GB back????

    Hi Allan!
    Thanks for your quick replay
    I sync it often......
    But I also updated my iPhone to ver.5 now it show 8,6GB free space.....
    Before 0,48GB free space
    I think the restore and the upgrade fixed the problem....

  • How can I zero out the memory on my macbook air?

    I have an 11 inch mid 2011 macbook air and cannot figure out how to erase the memory so that none of the data is recoverable. I booted from the recovery HD but when I went to the erase section of the menu, the security options button and the zero out empty space option were both greyed out. How can I clean off my Mac?

    You can't, and don't need to, zero an SSD in Disk Utility. Once you've erased it the data is unrecoverable.

  • How to detect knock out or overprint issue

    We have sent a printer test file (PDF file) to printer using default swatch color [black] 100% in Indesign CS3. Our procedure is to create postscript through PDF using Distiller 7.0. Printer came back and said your document has "Black text is set to knock-out" should be set as overprint. I have attached a sample page that is being sent to printer.
    We have enabled the option "Overprint [Black] Swatch at 100% under the preference menu.
    How do we ensure the PDF document does not have knockout/overprint and please help me how to resolve this issue before we dispatch to printer in future.
    JohnArul

    Acrobat's Separation Preview will let you highlight areas that are set to overprint. Go to Advanced > Print Production > Output Preview, then click on Color Warnings. No highlight, no overprint.
    Did you create a new black swatch for the text? InDesign overprints it's default [Black] by default, so if it's not overprinting something's quirky. Also, you're almost always better off exporting a PDF rather than printing to a PostScript file. Export using PDF/X-1a or the same joboptions file you used for Distilling. I doubt the Distilling vs Exporting is the cause of the lack of overprint.

  • How did I run out of memory?

    I own a G5 power pc iMac. It came with a 250 Gig Hard drive. I have about 50 Gigs worth of movies, music and photos. It seems I only have 40 Gigs left. How is that possible? Could I have doubled up files or something?. I have searched the hard drive but there's so many files that look the same. I tried deleting some (by moving them to the trash) But that only messed up my apps. Like iTunes now shows double and triple songs, so does iPhoto. It doubled up my photos. Is there anyway I can fix this myself?. I am afraid if I delete files I'll loose some content. Someone please help!
    iMac G5 (power PC)2.1 GHz. OS 10.4.7  
      Mac OS X (10.4.7)  

    Just to clear a few things. Moving things to the trash does not clear up space in your HD.
    Emptying the trash will clear up the space in your HD.
    As for your music files doubling when you trash them:
    Open iTunes>Preferences>Advanced>General
    Make sure "Copy files to iTunes Music folder when adding to library" is unchecked.
    That should stop the doubling & tripling of your music files when you trash them.
    If the above does not help, then I suggest that you repost your iTunes problem in the iTunes for Mac Forum where the iTunes users hang out.
    As for your iPhoto problem, suggest that you repost your problem in one of the iPhoto Forums where the iPhoto users hang out if Miriam's suggestion(s) does not work.

  • Passport WD Almost out of memory

    I used a Passport WD with 297GB capacity for backup.  Properties show I only have 21.2MB left.  How can I make room for future backups?

    Hi,
    The backup software should give you an option how many days/cycles do you want to keep. Just reduce number of days/cycles will help. Otherwise, buy a new, bigger (capacity) external HDD, they are very, very, very cheap now.
    Regards.
    BH
    **Click the KUDOS thumb up on the left to say 'Thanks'**
    Make it easier for other people to find solutions by marking a Reply 'Accept as Solution' if it solves your problem.

  • How to fix the "out of memory" issue in Fireworks?

    This issue is due to the excess GDI objects usage. If you get this message, as a workaround, close Fireworks after every few hours of work.
    Do the following to see the GDI objects used by a Windows application:
    Open Task Manager and select Process.
    Click View from the tool bar and click Select Columns.
    Select the GDI Objects check box.
    Click OK.

    you cant specify how many characters a td cell can have but u can specify the pixel width of a td cell
    <td width=50>
    as long as you have wrap text on, then text will not force the box size over the 50 pixels
    this wont limit it to only 50 chars though, you will probably have to use some javascript to cut the string down to size (unless youre using something like php or asp then that will do the trick too)

  • How to detect Memory Leaking Problem in Java

    I have a Java multithreading program & I suspect that there is a memory leaking issue in the program. Can someone tell me how can I know how to detect where is the memory leakage in the program?
    I have download a few tools like hat, jprobe, optimizeit but not sure how to use it. I am using jdk1.3.0 in HP-UX
    Thks

    Not so true, you could have a memory leak if you accidental hold on to a resource, or maybe you have threads running that you have no reference to, and those threads hold some resources.
    Optimizeit is pretty easy to use. You start you application with Optimize it, so Optimizeit is you JVM so to speak. In optimizeit you can get a list of active objects. If this list grows and grows, you probably have a problem. Let it run for a while, and see which objects are the most present, dubble-click it, and it lets you step down into you methods. This way you can maybe find you leak.
    Good luck :)

Maybe you are looking for