Java Memory Management

Hi,
Can any one help me in find out the memory of a particular java object is consuming............................
That means, is there any way so that I can find out the memory occupied by the Object.........
Thanks
Murali

Hi Murali,
As of such i don't find a method to find the memory of particular object but you can find the memory occupied by your application by using following three methods
Runtime.getRuntime().maxMemory(),Runtime.getRuntime().totalMemory(),Runtime.getRuntime().freeMemory();
As you wanted know the only the memory occupied by the object hope this url will help you out http://java.sun.com/developer/technicalArticles/J2SE/jconsole.html

Similar Messages

  • Java Memory Management/Out of Memory

    Hi Guys,
    I have a few questions about java memory management
    Because i keep encounter a lot of out of memory error which i think java does not handle Vector/ArrayList re initialisation automatically
    Asumme i have 2 million record in database and , i will process every 80000 and store it in Vector
    while(true)
    list = new Vector();
    list = GetResultFromDatabase() // Process Every 80000
    if list.size() > 0 =======> My VEctor list contain 80000
    //loop the 800000
    //Process Some logic and data
    list.clear();
    list = null;
    If u See , i need to call list.clear and list = Null every process so it wont cause me out of memory
    Before i put that 2 lines , i always hit out of memory Exception.
    Seems like garbage collector cannot claim memory if i dont declare
    Is Memory Occupied by VEctor cannot be recoverable if we dont explitcitynya clear it and set it to NULL??
    Because in term of logic wise it wont cause a problem if i just
    do in this statement after it process like below
    list = new Vector() which will reinstatiate the object.
    Thanks.

    Damm i should hacve read your post again
    Look here:
    while(true)
    list = new Vector();What uer doing is craeting a new vector object everytime the while does an ityteration so when your while loop does 40000 loops there will be 40000 new objects in jou memory
    i sugest moving the decleration outside the while loop:
      list = new Vector();
    while(true)
    ///rest of loop
    } This could also be a problem
    hope it help :-)
    werns

  • Java memory management & stack overflow

    Hi
    I am building an application in java. It has to keep track of a lot of objects, typically about 100 000 or so. When putting them in a linked list, I get stack overflow. Is there som way of storing all these objects that wont result in SOF error?

    This app is practically screaming "DATABASE!". I suggest that you listen to it.

  • Memory management in Java

    HI all,
    I want to know what is memory management in JAVA means ?Is it related to memory management of java VM.?

    Sorry for posting in wrong area. also sorry for cross posting . i close this discussion as i have posted a new topic. so dont reply plz.

  • Java Card Memory Managament: How do you free-up allocated memory?

    I have a problem with java card memory management, that causes the applet to hang. I think the java card runs out of RAM when my applet runs for several iterations or process() calls. My program requires significant size of bytes for each APDU command to be sent. (around 100-250 bytes, for each apdu.sendBytes() call).
    I use a temporary byte array buffer that will contain the APDU command to be sent, declared as:
    private byte [] tmpBuff;Before each process() call, the tmBuff is initialized and contains a new byte array containing the APDU command to be sent. (array size around 100-250 bytes).
    tmpBuff = new byte[] {0x00, ... } On the process() call, the tmpBuff is copied to APDU and sendBytes() function is called. The tmpBuff byte array is reinitialized after every process() call to contain the next command. After about 20 successful commands by the process() call, the applet seems to ran out of RAM and hangs.
    I suspect, that when tmpBuff is reinitialized before each process() call, the Java Card garbage collector does now free-up the memory that was used for the previous tmpBuff byte array initialization.
    Is there a way to reclaim the memory allocated for tmpBuff after it has been initialized?
    Or maybe call the Java card garbage collector?

    Cenon,
    Generally speaking, the new keywork is a bad idea outside the install method or constructors as the JCRE is not guarenteed to have a garbage collector (and if it does, has to be called explicitly by JCSystem.requestObjectDeletion(); This however is slow.
    A better option may be to use memory more efficiently than to rely on garbage collection. A way of doing this would be to have an instance variable that is initialised once and reused. This allows you to use either a transient or persistent array.
    public class TestApplet extends Applet {
        private final static short BUFFER_SIZE = (short) 300;
        private final byte[] buffer;
        private TestApplet() {
            // only have one of the following not commented out
            /* persistent buffer */
            // buffer = new byte[BUFFER_SIZE];
            /* transient buffer (much faster) */
            buffer = JCSystem.makeTransientByteArray(BUFFER_SIZE, JCSystem.CLEAR_ON_DESELECT);
        public static void install(byte[] bArray, short bOffset, byte bLength) {
            // GP-compliant JavaCard applet registration
            new TestApplet().register(bArray, (short) (bOffset + 1), bArray[bOffset]);
        public void process(APDU apdu) {
            // Good practice: Return 9000 on SELECT
            if (selectingApplet()) {
                return;
            // do some work here with buffer
    }In the above code you would be able to use the buffer to build the command and you will not have a memory leak.
    Cheers,
    Shane
    Edited by: safarmer on Jul 8, 2008 12:25 PM

  • OSX inactive memory management problems

    On my 2010 Macbook Air 11" running OSX 10.8 Mountain Lion, I have run into some major issues with memory management. This problem persists across both my Mac machines and multiple generations of OSX. I have a 2007 2.2 Ghz Core 2 Duo Macbook Pro Running Lion (upgraded from Tiger) with 3 gb 667Mhz DDR2 RAM and my 2010 Air 1.4Ghz Core 2 Duo (Upgraded from Snow Leopard to Mountain Lion) with 2gb 1067mhz DDR3 RAM. On both machines, for some time now, during normal usage; especially web browsing using Chrome and Safari (respectively); the inactive RAM on both machines will grow to consume around 30% of all RAM and force time consuming page outs to the mass storage drives on both machines. The Pro has a slower hard drive and the problem is the worst here, the air has a much faster SSD. I have found myself constantly having a window of Activity Monitor up on at least one of my desktops watching my RAM usage, using terminal to purge ram upwards of 10 times an hour to prevent costly page outs, especially on the Pro. I know Apple claims that inactive RAM is essentially free RAM that is temporarily storing recently used information for ease of access later and that it's supposed to be released as free memory when needed, but this obviously is not happening. Right now on my air my swap file is over 650Mb and I've seen it top 2Gb before. The air is exponentially better than the Pro due to the faster SSD, but I do notice substantial UI lag and a massive drop in fluidity as soon as my meager 2Gb is full and I start paging. The Pro is another story entirely, the entire system will essentially become unusable, having to wait several seconds for mouse clicks to even register. That's why I upgraded the stock 2Gb of RAM it comes with to 3Gb hoping that a 150% increase in RAM would help, but it just prolonged the inevitable. I still end up paging out just as bad across both systems if un checked. Even when I keep a close eye on memory usage and purge often, I still end up paging out because I'm not vigilant enough.
    I have to limit my browsing to less than 5 tabs and keep my number of open programs less than 2 on both machines. My active and wired memory rarely seem to top 70%, meaning the rest gets taken by inactive, which isn't functioning as Apple claims. Even if my conclusions aobut what is happening under the hood are incorrect, something is going terribly wrong. I can't upgrade the RAM on my Air at all, and the RAM on my Pro is capped at 4Gb. I'm holding on upgrading because I don't think the excess hardware will solve this software memory problem. Whatever is happening is causing a serious drop in performance for me (yes I do know I have underpowered machines), but there has to be something I can do to speed performance. I've read about disabling the dynamic page file entirely, which just seems to crash the system when free memory is gone, and I've read about programs that claim to free memory. Those programs seem to work by taking a high priority in the process heigharchy of the OS and then proceeding to eat up large portions of RAM and releasing them as needed in an attempt to replicate the true intentions of inactive RAM, but I've heard of problems with this method as well. Does anyone have a viable solution? Monitoring my RAM usage myself and ensuring I don't end up paging out is costly, time consuming, annoying, and inefficient since I fail to catch the problem before I page if I get particularly busy. There is no other OS I've ever been acquainted with that has this problem, not any flavor of Linux, not even the dreaded windows. I seriously hope Apple can do something to manage this runaway memory problem. I'd like to be able to open more than 3 windows in Safari. I've had to purge 3 seperate times while writing this on my Air, and I now have 678 inactive memory, 741 inactive, 582 wired, and less than 14Mb free out of 2Gb with a growing swap at 680Mb. Each purge becomes less and less effective and the last one I did freed up only about 100Mb and it got eaten up again by inactive in less than 10 seconds. On my Air, the memory hog is Safari right now at 700Mb between the web content and flash player with only Facebook, youtube, and this Apple Supprt tab open. I have NO other applications running in the fore or background other than Activity Monitor and Terminal. On my Pro the memory hog is always kernel task, I use Chrome and Safari both. While the memory used by the browser does not usually take up the most substantial portion of the total used RAM out of any process, the more tabs I open, the more RAM I use. The browser is usually the second heaviest RAM hog to Kernel Task. So it seems that across the two machines there are two lsightly different manifestations of the same problem with the same results: massive performance drops and extremely annoying and costly page outs no matter the reason. I just want this problem to go away. I've used underpowered windows laptops that can open a dozen tabs in a heavier browser like IE or Firefox while using other programs like Word or Excel and more with no memory lag issues. There's no way in **** I could manage to open that many pages in a browser while using Pages and/or Numbers on either of my machines and expect reliable (swap free performance). This is just kind of sad in my opinion. Does anyone have a way to get my OSX machine running smooth so that I can remove the one thing that windows and Linux fan boys get the right to laugh at my Macs for?

    Hi Zephryl,
    I was actually able to get an initial response from Sun on this a few months ago. However, the Sun Swing team has not followed up on a resolution for this pervasive problem, even though they noticed the same problem when running a test applet I had created for them. Apparently, I.E. is not releasing memory from the heap.
    Below is a quote from a Sun rep. on this in an e-mail sent to me on Dec 4, 2002:
    "I suspected the leak is in the native code because the # of handles and GDI objects keep increasing but no obvious Java objects are left behind in the Java heap during page switch."
    So, until Sun and/or Microsoft work out a solution to this, anyone who uses I.E. 6 and applets for their UI seems to be in a lot of trouble.
    As a note, trying to invoke the Garbage Collector does not do anything, but generally a very small amount of memory will be released (like maybe 5-10% of the memory allocated for the applet).
    Cheers!
    Avi Gray
    Global Computer Enterprises

  • How to determine the java memory cosumption

    Hi.
    In our system Netweaver7.1, (on windows)
    I want to know java heap memory consumption.
    We can see the memory consumption from windows task manager, but the AS JAVA caught the memory heap memory size during startup.
    So itisn't correct.
    In NWA, many paerformance monitors are, but I don't know which tool is useful.
    I want to sizing the memory size with following logic.
    8:00~9:00 50% load
    The java memory is conusmed 3GB.
    11:00~12:00 100% load
    The java memorry will "may" be consumed 6GB.
    regards,

    I found the directory with java.exe on my XP client. After updating my Path and then typing 'java -versions' I still see a 'java not found message'. No problem though - a README.TXT says that I have JRE 1.1.7B.
    One final question - a co-worker who also has XP just starting seeing a pop-up window saying 'Runtime' error when running a Java applet. His java.exe is in a path that includes the sub-directory 'JRE' On my XP client, java.exe is in a path which includes a 'JRE11' sub-directory. We therefore seem to have different versions of the JRE. Since I don't see the Runtime error when running the same applet, should my co-worker try upgrading his JRE?
    Thank you.

  • Oracle 9i Automatic PGA Memory Management

    Hello,
    my team and me, we are facing difficulties to change the size of the PGA used by our server processes for HASH JOIN, SORT... operators,
    here you can see the results of "select * from v$pgastat":
    [pgastat dynamic view results|http://pastebin.com/m210314dc]
    We have been increasing consecutively our pga_aggregate_target parameter from 1.7 Gb initially to 4Gb then at the end 6Gb, the value of "Global memory bound" and " aggregate pga auto target" on the link above are still equal to 0.
    I have been reading threads on the forum and documentation see below, I understand how the global memory manager (CKPT) computest the sql memory target and then the global memory bound, as far as I understand I can only "play" on the pga_aggregate_target value in order to increase the size of our PGAs (I exclude to play with hidden parameters).
    - Joze Senegacnik: Advanced Management of working areas in Oracle 9i/10g : http://tonguc.yilmaz.googlepages.com/JozeSenegacnik-PGAMemoryManagementvO.zip
    - Dageville Benoit and Zait Mohamed: SQL memory management in oracle 9i
    Here different information that could be usefull:
    OS: solaris 10 (db running in a non global zone)
    Arch: 64-bit sparcv9 kernel modules
    Physical memory: 32 Gb (being shared between all non global zones)
    Oracle version: 9.2.0.5 32bits
    Values of init parameters and hidden parameters that could be relevant:
    [init parameters|http://pastebin.com/m40340cf4]
    [hidden parameters|http://pastebin.com/m50d74c53]
    Maybe useful queries:
    over work areas views, I use the following script:
    [wa_analysis.sql|http://pastebin.com/d606ebd9b]
    and the result of it:
    [result of script wa_analysis.sql|http://pastebin.com/m5f49a2e5]

    Joze Senegacnik wrote:
    - either your sessions are using a lot of memory for storing variables like pl/sql arrays which is subtracted from automatic management: PGA_AGGREGATE_TARGET - (aggregated persistent area + a part of the run time area of all server processes)
    - you are hitting a bug
    - or maybe something elseI am really happy you come to this conclusion too, they are the same we made with my team and we have submitting to Oracle support via metalink SR 3-1216060641, we were asking if we hit the following bug (in note 1) or we leak about pl/sql or java... or else indeed,
    note 1: PGA_AGGREGATE_TARGET Assigned Memory Is Left Unconsumed When Set High [ID 844542.1]
    Joze Senegacnik wrote:
    I would like to know:
    1.) what were the values for global memory bound and autotarget immediately (or in short time) after the database restart or when you have increased them Just after the restart of the database and just after the change of P_A_T, we query v$pgastat immediately after and the value of global memory bound and auto target were equal to 0 byte,
    2.) If you are able to change value of PGA_AGGREGATE_TARGET (P_A_T) to 10GB what happens with global memory bound and auto traget. They should be positive at least for a short time. As this is a dynamic parameter you can change it for a short time, run queries and set it back.We plan to do this tonight, we have an "heavy" ITIL change management procedures that allow us to make changes approved by change manager and only during night maintenance window on production system, I come back to you tomorrow. But we have been increasing from 1,7Gb to 4Gb to 6Gb, each time I have been querying v$sgastat in the next 2 mins and global memory bound and auto target were equal to 0 byte.
    3.) Have you checked on the OS level how much memory are using server processes - do these numbers come along with what Oracle says. Not during problematic activities, meaning active work areas performing HASH-JOIN, SORT... operators,
    unfortunately it is a production system, even if he performs poorly, we are not allowed to try or retry the poor queries, but if it comes again I'll do it,
    during low activities, here the results paste with the scripts I used:
    [pga processes info in oracle|http://pastebin.com/f2e540062]
    I spooled the result rows of this previous script in /var/tmp/pga_processes.log then I loop over all processes pid and display pmap output anon info like this:
    h5. cat /var/tmp/pga_processes.log | awk -F' ' '{print $5}' | xargs -n 1 -i pmap -x {}| grep -v 'Addres' |egrep 'Kb' 2>&1 > /var/tmp/pga_processes_os.log
    then I merge line by line the two files with unix paste command, here the results:
    [os and oracle pga informations|http://pastebin.com/f4135c8a6]
    4.) How many server processes are running on you system in average/max and are you using just dedicated processes or also shared?in average 250, we are only using dedicated processes,
    5.) At time of low activity is the global memory bound still 0 or becomes > 0. I have been querying every 15 min during more than 24 hours low activities, it still stay to 0,
    5.) Are you experiencing paging/swapping on OS level?No, here orca figures for details:
    [free memory|http://img509.imageshack.us/img509/5897/ohuron1asd2gauge1024xfr.png]
    swap
    [pagein pageout|http://img121.imageshack.us/img121/6946/ohuron1asd2gaugepginper.png]
    [memory usage|http://img19.imageshack.us/img19/2213/ohuron1asd2gaugeppkerne.png]
    6.) Please post the result of: select * from X$QESMMSGA ;during low activities, [results X$QESMMSGA|http://pastebin.com/f61df7093]
    While you will be answering to my questions I'll try to figure out what we can do to properly diagnose the problem. As you are on 9i it is a little bit harder.I am really kind of your help, as we say in my country, "if you need tow arms one day to carry something, call me."
    --Jeremy Baumont                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Diagnostics Workload Analysis - Java Memory Usage gives BI query input

    Dears
    I have set up diagnostics (aka root cause analysis) at a customer side and I'm bumping into the problem that on the Java Memory Usage tab in Workload analyis the BI query input overview is given
    Sol Man 7.0 EHP1 SPS20 (ST component SP19)
    Wily Introscope 8.2.3.5
    Introscope Agent 8.2.3.5
    Diagnostics Agent 7.20
    When I click on the check button there I get the following:
    Value "JAVA MEMORY USAGE" for variable "E2E Metric Type Variable" is invalid
    I already checked multiple SAP Notes like the implementation of the latest EWA EA WA xml file for the Sol Man stack version.
    I already reactivated BI content using report CCMS_BI_SETUP_E2E and it gave no errors.
    The content is getting filled in Wily Introscope, extractors on Solution Manager are running and capturing records (>0).
    Did anyone come accross this issue already?
    ERROR MESSAGE:
    Diagnosis
    Characteristic value "JAVA MEMORY USAGE" is not valid for variable E2E Metric Type Variable.
    Procedure
    Enter a valid value for the characteristic. The value help, for example, provides you with suggestions. If no information is available here, then perhaps no characteristic values exist for the characteristic.
    If the variable for 0DATE or 0CALDAY has been created and is being used as a key date for a hierarchy, check whether the hierarchies used are valid for this characteristic. The same is valid for variables that refer to the hierarchy version.
      Notification Number BRAIN 643 
    Kind regards
    Tom
    Edited by: Tom Cenens on Mar 10, 2011 2:30 PM

    Hello Paul
    I checked the guide earlier on today. I also asked someone with more BI knowledge to take a look with me but it seems the root cause analysis data fetching isn't really the same as what is normally done in BI with BI cubes so it's hard to determine why the data fetch is not working properly.
    The extractors are running fine, I couldn't find any more errors in the diagnostics agent log files (in debug mode) and I don't find other errors for the SAP system.
    I tried reactivating the BI content but it seems to be fine (no errors). I reran the managed system setup which also works.
    One of the problems I did notice is the fact that the managed SAP systems are half virtualized. They aren't completely virtualized (no seperate ip address) but they are using virtual hostnames which also causes issues with Root Cause Analysis as I cannot install only one agent because I cannot assign it to the managed systems and when I install one agent per SAP system I have the message that there are already agents reporting to the Enterprise Manager residing on the same host. I don't know if this could influence the data extractor. I doubt it because in Wily the data is being fetched fine.
    The only thing that it not working at the moment is the workload analysis - java memory analysis tab. It holds the Key Performance Indicators for the J2EE engine (garbage collection %). I can see them in Wily Introscope where they are available and fine.
    When I looked at the infocubes together with a BI team member, it seemed the infocube for daily stats on performance was getting filled properly (through RSA1) but the infocube for hourly stats wasn't getting filled properly. This is also visible in the workload analysis, data from yesterday displays fine in workload analysis overview for example but data from an hour ago doesn't.
    I do have to state the Solution Manager doesn't match the prerequisites (post processing notes are not present after SP-stack update, SLD content is not up to date) but I could not push through those changes within a short timeframe as the Solution Manager is also used for other scenarios and it would be too disruptive at this moment.
    If I can't fix it I will have to explain to the customer why some parts are not working and request them to handle the missing items so the prerequisites are met.
    One of the notes I found described a similar issue and noted it could be caused due to an old XML file structure so I updated the XML file to the latest version.
    The SAPOscol also throwed errors in the beginning strange enough. I had the Host Agent installed and updated and the SAPOscol service was running properly through the Host Agent as a service. The diagnostics agent tries to start SAPOscol in /usr/sap/<SID>/SMDA<instance number>/exe which does not hold the SAPOscol executable. I suppose it's a bug from SAP? After copying the SAPOscol from the Host Agent to the location of the SMD Agent the error disappeared. Instead the agent tries to start SAPOscol but then notices SAPOscol is already running and writes in the log that SAPOscol is already running properly and a startup is not neccesary.
    To me it comes down the point where I have little faith in the scenario if the Solution Manager and the managed SAP systems are not maintained and up to date 100%. I could open a customer message but the first advice will be to patch the Solution Manager and meet the prerequisites.
    Another pain point is the fact that if the managed SAP systems are not 100% correct in transaction SMSY it also causes heaps of issues. Changing the SAP system there isn't a fast operation as it can be included in numerous logical components, projects, scenario's (CHARM) and it causes disruption to daily work.
    All in all I have mixed feelings about the implementation, I want to deliver a fully working scenario but it's near impossible due to the fact that the prerequisites are not met. I hope the customer will still be happy with what is delivered.
    I sure do hope some of these issues are handled in Solution Manager 7.1. I will certainly mail my concerns to the development team and hope they can handle some or all of them.
    Kind regards
    Tom

  • Memory management while implementing JNI interfaces.

    The assumption here is that java code calls a C function from a
    shared library in Linux.
    How should memory management be done in the native code called
    from Java using a JNI interface?
    What role does the Garbage Collector play in handling memory that
    was allocated in the native C code?
    If I allocate memory using malloc() in the C program, should I
    explicitly free it? Will the GC take care of it?
    Does anyone have an idea of how memory management be done while
    implementing a JNI interface?
    Thanks,
    Nisahnt

    NishantMungse wrote:
    The assumption here is that java code calls a C function from a
    shared library in Linux.
    How should memory management be done in the native code called
    from Java using a JNI interface?
    C: Alloc something giving a pointer
    C: Return pointer to Java as a long.
    C: As needed methods take a long parameter and cast to correct pointer.
    C: Provide a destroy() method that takes a long, casts to correct pointer and deallocates correctly.
    Java: class keeps long
    Java: As needed JNI methods are passed long
    Java: Provide a destroy() method which passes long to C destroy() method if long is not zero. After call set long to zero.
    Java: Optional: Add a finalizer. It calls destroy()
    Last step is optional if your programming environment is strict AND the usage of the class has a restricted scope.
    The above assumes that you are going to use the memory in a 'normal' way. For instance there allocations are relatively small, and exist for short amounts of time. If that isn't true then you might need to tune the usage in much the same way that you might if you had a Java class that consumed a large amount of memory.
    What role does the Garbage Collector play in handling memory that
    was allocated in the native C code?
    It doesn't.
    At some point it can interfere with the heap though.
    If I allocate memory using malloc() in the C program, should I
    explicitly free it? Will the GC take care of it?
    You must explicitly free it.
    Does anyone have an idea of how memory management be done while
    implementing a JNI interface?See above.

  • Memory manager - Profiler

    I will have several questions about memory management,
    garbage collection by Flash.
    First of all can anyone explain what is the link between the
    memory usage of the profiler and the System.totalMemory value.
    I use a module to display the totalMemory value evolution
    with a timeline chart (get the totalMemory value every 0.5 second
    and keeping only last 300 values).
    Here what I get : after about 4 hours of time running, the
    memory usage peak is about 24 Mbytes, BUT the System.totalMemory is
    about 600 Mbytes !!
    Before trying to understand why I have this memory
    consumption, I would like to understand the difference between what
    the profiler is measuring (24 Mbytes) and the memory used by the
    Flash Player (600 Mbytes).
    Thanks

    This is a loaded question but let me try to take a stab at it:
    First, let's right away eliminate the 'Minimize Application' issue; the memory that goes way down to 1 meg is the actual Real Memory being used by the Application, by minimizing it, you are putting all the application memory space into the Windows swap file. When you restore the application, then you will see the value grow again back to where it was by taking the swapped out pages back into real memory.
    The difference between the memory profiler and the task manager could be drastic in terms of consumption, the memory profiler is tracking only the java objects allocated and freed by your application, the task manager is look at the Windows Process as a whole, which contains a Virtual Machine that needs memory to store loaded classes, internal data and application heap (which are the actual java objects). The application heap will be usually far bigger than the cumulative total number of objects in your application.
    A usual way to use the memory profiler is to, by running it on your application, take a snapshot of the memory before an expensive operation, perform the operation, then take a snapshot again and see what is left to make sure no leaks are being created.
    In order to find out why your expensive operation is so... expensive, is to increase the granularity of the operation up to a point where you will get to the few sections of code that allocate all that memory.
    Hope that helps,
    Michel

  • DAC Service shuts down with Java Memory when regenerating indexes.

    We have set up to run the DAC as a windows service. We have just set up a new execution plan comprising subject areas from Financials and Inventory. When we run the first full load, the execution plan executes all steps, but when it starts to run the last task: QUERY_INDEX_CREATION, the DAC service shuts down subsequently failing the execution plan. In the stderr.log we see the following:
    11-11-2008 16:44:59 global
    SEVERE:
    ANOMALY INFO:::
    MESSAGE:::Database Object should be specified for sql commands.
    EXCEPTION CLASS::: com.siebel.analytics.etl.etltask.TaskInitializationException
    com.siebel.analytics.etl.etltask.SQLTask.doInit(SQLTask.java:86)
    com.siebel.analytics.etl.etltask.CountTableTask.doInit(CountTableTask.java:59)
    com.siebel.analytics.etl.etltask.GenericTaskImpl.init(GenericTaskImpl.java:129)
    com.siebel.etl.engine.core.Session.getTargetTableRowCounts(Session.java:3057)
    com.siebel.etl.engine.core.Session.run(Session.java:2972)
    java.lang.Thread.run(Thread.java:619)
    11-11-2008 16:45:04 global
    SEVERE: MESSAGE:::Java heap space
    EXCEPTION CLASS::: java.lang.OutOfMemoryError
    java.util.Arrays.copyOfRange(Arrays.java:3209)
    java.lang.String.<init>(String.java:216)
    java.lang.StringBuilder.toString(StringBuilder.java:430)
    com.siebel.etl.engine.core.IndexPropertyFactory.createIndexProperty(IndexPropertyFactory.java:28)
    com.siebel.etl.engine.core.Index.<init>(Index.java:71)
    com.siebel.etl.engine.core.TableIndexHandler.loadIndexes(TableIndexHandler.java:329)
    com.siebel.etl.engine.core.TableIndexHandler.populate(TableIndexHandler.java:96)
    com.siebel.etl.command.IndexCreationCommand.doExecute(IndexCreationCommand.java:64)
    com.siebel.etl.command.SqlCommand.doExecute(SqlCommand.java:9)
    com.siebel.etl.command.MultiSourceSqlCommand.execute(MultiSourceSqlCommand.java:82)
    com.siebel.etl.database.AsyncDatabaseCall.run(AsyncDatabaseCall.java:34)
    java.lang.Thread.run(Thread.java:619)
    11-11-2008 16:45:04 global
    SEVERE: MESSAGE:::Java heap space
    EXCEPTION CLASS::: java.lang.OutOfMemoryError
    java.util.Arrays.copyOfRange(Arrays.java:3209)
    java.lang.String.<init>(String.java:216)
    oracle.jdbc.driver.CharCommonAccessor.getString(CharCommonAccessor.java:385)
    oracle.jdbc.driver.T4CVarcharAccessor.getString(T4CVarcharAccessor.java:411)
    oracle.jdbc.driver.OracleResultSetImpl.getString(OracleResultSetImpl.java:397)
    oracle.jdbc.driver.OracleResultSet.getString(OracleResultSet.java:1515)
    com.siebel.etl.database.DAWResultSet.getString(DAWResultSet.java:597)
    com.siebel.etl.engine.core.TableIndexHandler.loadIndexes(TableIndexHandler.java:301)
    com.siebel.etl.engine.core.TableIndexHandler.populate(TableIndexHandler.java:96)
    com.siebel.etl.command.IndexCreationCommand.doExecute(IndexCreationCommand.java:64)
    com.siebel.etl.command.SqlCommand.doExecute(SqlCommand.java:9)
    com.siebel.etl.command.MultiSourceSqlCommand.execute(MultiSourceSqlCommand.java:82)
    com.siebel.etl.database.AsyncDatabaseCall.run(AsyncDatabaseCall.java:34)
    java.lang.Thread.run(Thread.java:619)
    11-11-2008 16:45:05 global
    SEVERE: Failed due to the following reason: Java heap space
    11-11-2008 16:45:05 global
    SEVERE: Failed due to the following reason: Java heap space
    11-11-2008 16:45:10 global
    SEVERE: MESSAGE:::Java heap space
    EXCEPTION CLASS::: java.lang.OutOfMemoryError
    This is repeated many times in the log. It manages to create some indexes, but eventually it shuts down the DAC windows service
    In the windows event viewer we then see this at 11-11-2008 16:
    "The Java Virtual Machine has exited with a code of 10, the service is being stopped."
    My guess is that we need to allocate more memory to the DAC Java VM, but how/where?
    Any ideas?
    best regards,
    Henrik Verup
    Edited by: [email protected] on Nov 20, 2008 10:34 AM
    We have managed to work around the problem, by changing the DAC Sytem Property (under Setup): CreateQueryIndexesAtTheEnd from true to false. This way, indexes are being rebuilt during the load - not at the end. This has helped in getting the execution pla to finisf succesfully. We are now working on how to increase Java heap memory of the DAC Server, when started as a windows service. We have installed a windows service to stop and start the DAC serve,r using a document by Olivier Lemaire from Oracle.
    Does anyone have experiences on this?

    java Heap memory in DAC can be increased from the Client Side .
    Open the file for editing----startclient
    echo off
    title Siebel DAC Client
    call config.bat
    Rem Uncomment the below if you want to see a DOS window with messages.
    Rem and comment out the JAVAW line.
    Rem
    Rem %JAVA% -Xms256m -Xmx1024m -cp %DACCLASSPATH% com.siebel.analytics.etl.client.view.EtlViewsInitializer
    Rem
    start %JAVAW% -Xms256m -Xmx1024m -cp %DACCLASSPATH% com.siebel.analytics.etl.client.view.EtlViewsInitializer
    edit 1024 and increase the heap memory sizee,this should work.We faced a similar issue and increasing the size of the java memory solved the issue.
    Let me know if this is solved

  • Oracle oas 10.1.3 oc4j java memory pools info...?

    Hello!
    I need to find info about java memory in JVM. What is :
    PS Eden Space
    PS Old Gen
    PS Perm Gen
    PS Survivor Space
    PS MarkSweep
    PS Scavenge
    regards - Marcin

    user8672998 wrote:
    Hello!
    I need to find info about java memory in JVM. What is :
    PS Eden Space
    PS Old Gen
    PS Perm Gen
    PS Survivor Space
    PS MarkSweep
    PS Scavenge
    regards - MarcinHi Marcin,
    To monitor the java memory and to find info on the memory pools & GC parameters, you must first verify that you are running OC4J on JDK release 5.0, and than you must set the jmxremote property for the OC4J instance.
    Using Application Server Control to Set the jmxremote System Property
    To set the enable monitoring of JVM J2SE 5.0 metrics from Application Server Control:
    1. Navigate to the OC4J Home page for the OC4J instance.
    2. Click Administration to display the OC4J Administration page, which contains a table listing the various administration tasks you can perform for this OC4J instance.
    3. If necessary, expand the Services section of the table by clicking the expand icon or by clicking Expand All.
    4. Click the task icon in the Server Properties row of the table to display the OC4J Server Properties page.
    5. Scroll down to the Command Line Options section of the page and select Enable J2SE 5.0 Platform MBeans.
    6. Click Apply to apply the changes.
    7. Navigate to the Cluster Topology page, select the OC4J instance, and then click Restart.
    Manually Setting the jmxremote System Property
    You can also enable monitoring of JVM J2SE 5.0 metrics manually, by including the following string as an OC4J runtime startup option:
    com.sun.management.jmxremote
    Refer the section "Setting System Properties at Startup" in the Oracle Containers for J2EE Configuration and Administration Guide for detailed instructions on how to specify OC4J runtime startup options.
    Specifically, if you are running OC4J in a standalone environment, you must include the following argument to the OC4J java command:
    java -Dcom.sun.management.jmxremote -jar oc4j.jar
    Or, if you are running OC4J in a Oracle Application Server managed environment, you must include the following argument in the start-parameters java-options element in the opmn.xml file:
    <ias-component id="OC4J">
    <process-type id="home" module-id="OC4J" status="enabled">
    <module-data>
    <category id="start-parameters">
    <data id="java-options" value="-Dcom.sun.management.jmxremote"/>
    </category>
    </module-data>
    </process-type>
    </ias-component>
    Regards,
    ~Pointer

  • Memory management strategy

    I have a process that can benefit from lots of physical memory. I'm having trouble figuring out how to manage it.
    Essentially, the process needs pages of memory to store data temporarily. When the systems hits some kind of memory limit, then it can flush all data to disk and start over. More memory significantly improves performance because flushes are less frequent.
    The problem arises because I can't distinguish between physical and virtual memory, and I can't tell how much memory is available to me. When I grab too much memory, the whole process grinds to a halt because of swapping, or generates Out of Memory errors. Too little and performance is sub-optimal. Further complicating the situation is the fact that other threads are running in the same JVM consuming memory, and that we distribute this app into unknown environments with unknown amounts of memory.
    So here are my thoughts so far:
    Strategy 1:
    Just allocate pages as needed until an OutOfMemoryError occurs. Trap it, flush, and continue. This works, but the app grinds to a halt once the system starts allocating virtual memory.
    Strategy 2:
    Allocate pages as needed until java.lang.getRuntime().freeMemory() drops below a threshhold value. This doesn't work because freeMemory() doesn't report the amount of free system memory, only the amount of free memory in the pool currently allocated from the operating system. On startup it could show as little as 2mb free on a 512mb machine.
    Strategy 3:
    Allocate pages up to a fixed amount, like 64mb. This fails when less than 64mb is free, and fails to take advantage of other memory that may be available. We could make this amount user-configurable, but most of our users aren't going to be capable of handling that.
    Strategy 4:
    Do something with soft or weak references. This has potential, but I can't figure out how to get notified when a reference is about to be garbage collected.
    Anyone have better ideas?

    To summarize: you would like to manage memory; real memory is faster than virtual memory; you can't tell how much real memory is available to you.
    Let's take the middle statement: when you start using virtual memory, your application slows down? If that's the case, maybe you could have it time itself and when it starts slowing down, assume that's the cause. You'd have to have a standard bit of code that you could monitor for slowdowns. Of course that could be fooled if another task started eating the CPU, by for example doing a search-and-replace in a 100-MB document in memory. But likely you would be running this task on a dedicated system, or at least one without large competing tasks.
    I think you're in uncharted territory here. I haven't seen any articles on this kind of memory management in Java. My suggestion would be to provide tuning parameters (such as maximum memory to use) and allow your users to adjust them based on actual conditions, instead of trying to have your application try to optimize itself. As you observe, your app doesn't have nearly enough information to do that.

  • Use JNI application has memory manager, feasible?

    Hi,
    This is an attempt to circumvent javas poor memory management capabilities. Since java is unable to allocate memory dynamically (*) I'm thinking of writing a native library capable of allocating memory and then allowing java applications to stow away data in this area. The application would be able to access the memory directly through some java.nio.ByteArray-type implementation.
    The java application would be responsible for allocating and deallocating, reading and writing data.
    Is this feasible? Has anyone done this already? I guess a JNI is solution would be pretty straightforward?
    (...this will be my first experience with JNI)
    (*) Xmx option can be used assuming you know beforehand the memory requirements.

    Hi,
    This is feasible since JNative already does this.
    See Pointer and MemoryBlockFactory classes to do this.
    --Marc (http://jnative.sf.net)                                                                                                                                                                                                                                                                                           

Maybe you are looking for

  • Is Aperture Useful with unsupported digital cameras like FujiFilm S100FS?

    I have been evaluating and comparing Apple Aperture with Adobe Lightroom. For me, Aperture would be my preference if my camera was supported. Note that I already am using Photoshop CS5, but could use the supplemental organizing capabilityies of Apert

  • Finesse 10.5 Internal Chat

    Hello guys, We have implemented UCCX 10.5 with Finesse for a customer and have tried to enable internal chat for the agents with no success. According to the Data Sheet, Finesse offers the ability to chat with individual members or the entire team (a

  • Setting ScrollBars From Child Class

    I have a JScrollPane which contains a JPanel that displays an image. I have a rubberband box which will zoom in on the image which works fine. The problem that I am having, is that I need to adjust the JScrollPane's sliders. From within the mouse lis

  • Portrait /landscape

    Hello I recently bought a b109a used printer,I have it up and running,but I am having problems printing in portrature,not landscape.I have the portraiture box ticked,but no luck.I am unable to download Adobe reader,to get the instruction manual,as it

  • Deleted commercials from video in QT7 but converted to AVI they are back

    First, I recorded an old foreign movie to the TiVo, then transferred it to my Mac, and tried to edit and burn it with Toast 10. The sound wasn't right. Eventually, I was able to convert the video to a QuickTime .mov file. I then used the QT7.6.6 edit