Java 2D Memory

Hi,
I am using Swing and Java 2D to vizualize, process and aimate images.
I am having two problems:
* Problem 1:
I am loading png images (10K) (787 x 738 pixels). I am loading the images using:
public static Image getImage(String name, Component cmp) {
Image image = cmp.getToolkit().createImage(name);
MediaTracker tracker = new MediaTracker(cmp);
tracker.addImage(image, 0);
try {
tracker.waitForID(0);
if (tracker.isErrorAny()) {
System.out.println("Error loading image " + name);
} catch (Exception ex) { ex.printStackTrace(); }
return image;
//Then a recover the image and create a BufferedImage:
this.bufferedImage.createGraphics().drawImage(image, 0, 0, null);
each image loaded is taking 2 MB RAM,
When I am animating , depending on the number o images loaded, the memory goes to 80MB.
I need to reduce de memory loaded for each image.
Problem 2:
Even when the animation finish, and I close de frame with the AnimatingSurface, the
memory doesn't decrease. The only reference I keep for the bufferedImage is on my
class ImageData. When a close the animation frame, I release this objects
(ImageData) and I call System.gc().
I know the objects are being released becaus the method finalize is called.
But the memory doesn't decrease.
Can you give me a tip?
Thanks a lot!
Paloma

Problem 1:
Quick math tells me that 787x738 images are 580,806 pixels.. and at 4 bytes a pixel thatsn 2,323,224 bytes.. So there are your 2 megs of memory. The only way not to use that much is to either (A) use smaller images, or (B) decompress them just before you need them, and dispose of them when your done.. Both options stink but reality is reality.
You can try calling flush() on the image after using it, that may remove the uncompressed representation.. but I'm not sure about that.
Problem 2:
Most likely there are other references to the images that you've forgotten about or do not know exist. Try calling flush() on the images as that should dispose of cached representations according to javadoc.

Similar Messages

  • When does java deallocate memory for objects;

    um i'm working on a midp application that is very memory consuming. i would like to optimise it and make it just the oposite of what it is. now i would like to know when does java dellocate memory for an object, is it when it can find no more references to that object? or some other time, well i know its not when it can find no more references to that object because i've already tried that.
    or to make things simpler is there any explicit way to make java deallocate memory for a specific object, like if i have a thread, which is executing a while loop, and i want java to end the thread and free its memory. is there any way to do this?

    I happen to have quite some J2ME experience and it's not overly wise to count on extensive garbage collection. The garbage collector in limited device VMs isnt as advanced as it's big brothers. Try to avoid excessive object allocation and reuse instances whenever possible.
    As for garbage collection, objects will be garbage collected if they can no longer be reached by any of the active application threads and if the garbage collectors deems it necessary to collect garbage, which will probably be when free heap memory becomes sparse or when there's some idle time in your application.

  • Is there a way to define the ideal size of the java heap memory?

    Hello all!
    Is there a way to define the ideal size the java heap memory? I'm using a server with (IR,FR,WA) installed and i'm using the Windows Server 2008 R2 with 32GB of ram memory. I have other server with the same configuration using essbase. How can i set the heap memory? I have around 250 users (not simultaneous).
    Regards,
    Rafael Melo
    Edited by: Rafael Melo on Aug 17, 2012 5:40 AM

    For 2008 which is 64 bit you can have
    For FR in windows registry
    HKEY_LOCAL_MACHINE\SOFTWARE\Hyperion Solutions\Hyperion Reports\HyS9FRReport
    Xms and Xmx can have 1536 each.
    For workspace
    Start “Start Workspace Agent UI” service and open Configuration Management
    Console (CMC) via http://localhost:55000/cmc/index.jsp
    for
    Workspace Agent / Common Services Java Heap size you can have
    Xms and Xmx as 1024 each.

  • Activity Monitor - Java Virtual Memory Use is 16,333.00 TB.  How is this possible?

    Activity Monitor:   Virtual Memory column -
    Java Real Memory @ 330 MB
    Java Virtual Memory was 16,333 TB. 
    How could this be?
    Running:
    Safari
    Mail
    Pages
    Activity Monitor open
    Safari was incredibly slow today, as it has been a lot lately, but inconsistently.  The other computers in the house had normal speed.  I'm not a tech person.  I attached a copy of the activity monitor - how it looks right now.  I appreciate your thoughts and suggestions.  Thank you.
    bottom half

    As Kappy says, the virtual memory information is mostly meaningless except to developers, and most of them do not really care.
    In this case the Java VM usage is most likely a math error on the part of either the operating system, or Activity Monitor (when a 64-bit number goes negative, but is then displayed as an unsigned value, it can look like what you are seeing; ignore it).
    What you ARE interested in is "Real Memory" usage, and who is using it.  Look at those numbers in Activity Monitor.
    If you want to see if pageout activity is affecting your performance, then start Applicaitons -> Utilities -> Terminal and run the command "sar -g 60 100" which will report pageout numbers once a minute for 100 minutes (adjust the numbers to suit your tastes).   Mostly zero means no pages outs.  Occassional spikes generally occur when starting an app or switching to an app which has been idle for awhile.  Sustained pageouts starts to indicate a problem.  High sustained pageouts means you could benefit from either having more RAM or running fewer concurrent applications.

  • 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

  • Problem with Java and Memory

    hi,
    i have 512MB Memory in my pc, but the SUN ONE uses only 64MB.
    i dont know where is the problem. is it in the Run time of java of in the GUI Studio from Sun?
    how can i increase the number 64?
    i do nothing eccept java on this pc.
    thx

    Did you encounter a java.lang.OutOfMemoryError when running java? If not, nothing needs to be fixed.
    Still, you can specify the initial and max heap size for your java application on startup. Use the options -Xms<size> and -Xmx<size>, respectively. To see the non-standard options of your JVM, type "java -X"
    in a command shell.
    Cheers, HJK

  • Java heap memory errors..

    I make a spider program, but it runs out of memory after ~200 websites.
    after that it crashes.. or becomes so slow its useless.
    The problem is in this Spider class , that cant be garbage collected (But I dont see any reason why not)
    These profilers i have seen show you that memory is allocated and cant be garbage collected , but not where ? Can anyone give suggestions what can be wrong with this class or tell how they fix memory problems?
    peter
    import java.util.*;
    import java.net.*;
    import java.net.MalformedURLException;
    import java.net.URL;
    import java.net.URLConnection;
    import java.io.File;
    import java.io.FileNotFoundException;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.PrintWriter;
    import org.htmlparser.util.ParserException;
    import org.htmlparser.Node;
    import org.htmlparser.NodeFilter;
    import org.htmlparser.Parser;
    import org.htmlparser.PrototypicalNodeFactory;
    import org.htmlparser.tags.BaseHrefTag;
    import org.htmlparser.tags.FrameTag;
    import org.htmlparser.tags.TitleTag;
    import org.htmlparser.tags.HeadingTag;
    import org.htmlparser.tags.LinkTag;
    import org.htmlparser.tags.MetaTag;
    import org.htmlparser.util.EncodingChangeException;
    import org.htmlparser.util.NodeIterator;
    import org.htmlparser.util.NodeList;
    import org.htmlparser.util.ParserException;
    import org.htmlparser.beans.StringBean;
    public class Spider implements Runnable {
       private URL base;
       private int siteid;  
       private int companyid;
       private int MaxPaginas;
       protected Collection workloadPath = new ArrayList(3);
       protected Collection workloadError = new ArrayList(3);
       protected Collection workloadWaiting = new ArrayList(3);
       protected Collection workloadProcessed = new ArrayList(3);
       protected ISpiderReportable report;
       protected Done done;
       protected Parser mParser;
       String content = "";
       String meta = "";
       String titel = "";
       String kopjes = "";
       static private int count = 0;
       private int taskNumber;
      public Spider(int DBcompanyid, int DBsiteid, URL DBbase, ISpiderReportable report)
         base = DBbase;
         siteid = DBsiteid;
         companyid = DBcompanyid;
         MaxPaginas = 20;
         this.report = report;
         count++;
         taskNumber = count;
         mParser = new Parser ();
         PrototypicalNodeFactory factory = new PrototypicalNodeFactory ();
         factory.registerTag (new LocalLinkTag ());
         factory.registerTag (new LocalMetaTag ());
         factory.registerTag (new LocalFrameTag ());
         factory.registerTag (new LocalTitleTag ());
         factory.registerTag (new LocalHeadingTag ());
         mParser.setNodeFactory (factory);
      public void run()
          clear();
          report.koppelDB(siteid,companyid);
          addURL(base);
          begin();
      public Collection getWorkloadPath()
        return workloadPath;
      public Collection getWorkloadError()
        return workloadError;
      public Collection getWorkloadWaiting()
        return workloadWaiting;
      public Collection getWorkloadProcessed()
        return workloadProcessed;
      public void clear()
        getWorkloadError().clear();
        getWorkloadWaiting().clear();
        getWorkloadProcessed().clear();
        getWorkloadPath().clear();
      public void addURL(URL url)
        if ( getWorkloadWaiting().contains(url) )
          return;
        if ( getWorkloadError().contains(url) )
          return;
        if ( getWorkloadProcessed().contains(url) )
          return;
        if ( getWorkloadPath().contains(url.getPath()) )
          return;
         getWorkloadPath().add(url.getPath());
         log("PROCES: " + taskNumber + "  Adding to workload: " + url );
         getWorkloadWaiting().add(url);
         MaxPaginas--;
       protected void processURL (URL Furl) throws ParserException
              NodeList Nlist;
             getWorkloadWaiting().remove(Furl);
             getWorkloadProcessed().add(Furl);
             String url = Furl.toString();
             StringExtractor se = new StringExtractor (url);
             try
                content = se.extractStrings ();
            catch (ParserException e)
                    e.printStackTrace ();
            try
            mParser.setURL (url);
                try
                   Nlist = new NodeList ();
                    for (NodeIterator e = mParser.elements (); e.hasMoreNodes (); )
                        Nlist.add (e.nextNode ());
                catch (EncodingChangeException ece)
                    mParser.reset ();
                    Nlist = new NodeList ();
                    for (NodeIterator e = mParser.elements (); e.hasMoreNodes (); )
                        Nlist.add (e.nextNode ());
            catch (ParserException pe)
               String message;
               message = pe.getMessage ();
               if ((null != message) && (message.endsWith ("does not contain text")))
                    System.out.println("Is geen text bestand...");
                else
                    throw pe;
            report.writeDB(siteid,(String)Furl.getPath(),content, titel, meta, kopjes);
            String content = "";
            String meta = "";
            String titel = "";
            String kopjes = "";
            log("Complete: " + url);
        class LocalLinkTag extends LinkTag
            public void doSemanticAction ()
                throws
                    ParserException
                if(!isHTTPLikeLink())
                    return;
                String link = getLink();
               int index = link.indexOf('#');
                 if (index != -1)
                     link = link.substring(0, index);
                if(MaxPaginas>1)
                   handleLink(base,link);
                else
                    return;
        class LocalFrameTag extends FrameTag
            public void doSemanticAction ()
                throws
                    ParserException
                String link = getFrameLocation ();
                if(MaxPaginas>1){
                    handleLink(base,link);
       public class StringExtractor
         private String resource;
         public StringExtractor (String resource)
            this.resource = resource;
         public String extractStrings ()
            throws
               ParserException
            StringBean sb;
            sb = new StringBean ();
            sb.setLinks (false);
            sb.setURL (resource);
            return (sb.getStrings ());
        class LocalTitleTag extends TitleTag
            public void doSemanticAction ()
                throws
                    ParserException
                titel = getTitle();
        class LocalHeadingTag extends HeadingTag
           public void doSemanticAction ()
                throws
                    ParserException
                kopjes = kopjes + " " + toPlainTextString();
          class LocalMetaTag extends MetaTag
            public void doSemanticAction ()
                throws
                    ParserException
                String metaNaam = null;
                metaNaam = getMetaTagName();
                if(metaNaam!=null)
                    if(metaNaam.equals("keywords") || metaNaam.equals("description"))
                            meta = meta + " " + getMetaContent();
      public void begin()
        while ( !getWorkloadWaiting().isEmpty()) {
           Object list[] = getWorkloadWaiting().toArray();
          for ( int i=0;(i<list.length);i++ )
          try{
             processURL((URL)list);
    }catch(ParserException pe){
    System.out.println("Parser error:"+pe);
    MaxPaginas++;
    protected void handleLink(URL base,String str)
    try {
    URL url = new URL(base,str);
    if ( report.spiderFoundURL(base,url)){
    addURL(url);
    } catch ( MalformedURLException e ) {}
    public void log(String entry)
    System.out.println(entry );
    It must have something to do with the inner classes and processURL since i replaced only this code Swing parser with htmlparser.
    I dont expect anyone to exactly say this is wrong or that, but maybe some tools and suggestions how to solve would be very welcome.
    thanks

    The structure is like this:
    public class test{
      public static void main(String args[])
             test x = new test();
             x.execute();
      public void execute()
         ThreadPool pool = new ThreadPool(10);
          for (int i = 0; i < size; i++ )
              pool.assign(new Spider(DBcompanyid, DBsiteid, base,this));
         pool.complete();
    }

  • How does Java structure memory for an object's members?

    I'm trying to figure out how Java structures/allocates memory for objects. (Yes this is implementation specific. I'm using the Oracle 1.7 runtime for this.) I did some work on this here and here and the results are confusing.
    First off, in both referenced links, when I allocated an array of objects, the equivalent of new Object[10000], it used 4 bytes per object. On a 32-bit system this makes perfect sense. But I'm on a 64-bit system so what's going on here?
    Is Java limited to a 32-bit address space even on 64-bit systems?
    Is Java limited to a 32-bit address space per array and each array object then has a pointer to where the elements are?
    Something else?
    Second, I compared the memory footprint of 8 booleans vs. a byte as the variables in a class. The 8 booleans requires 24 bytes/object or 3 bytes/boolean. The single byte approach requires 10 bytes/object.
    What is going on with 3 bytes/boolean? I would understand 4 (making each an int) and definitely 1 (making each a byte. But 3?
    And what's with expanding a byte to 10 bytes? I would understand 8 where it's expanding a byte to a native int (I'm on a 64-bit system). But what's with the other 2 bytes?
    And in the case of different ways to create a RGB class it gets really weird.
    For a class composed of 3 byte variables it uses 24 bytes/instance. Expensive but understandable as each uses an int.
    So I tried where each class is a single int with the RGB stored in parts of the int (using bit shifting). And it's still 24 bytes/instance. Why on earth is Java taking 3 ints for storage? This makes no sense.
    But the weirdest case is where the class has a single variable of "byte[] color = new byte3;" Note that the byte is allocated so it's not just a null pointer. This approach takes less memory than the other two approaches. How???
    Any guidance as to what is going on here is appreciated. I have a couple of classes that get allocated a lot and the flywheel pattern won't work (these objects have their values changed all over the place).
    And an associated question, does the order of declaring variables matter? Back in the old days when I did C++ programming, declaring "int, byte, int, byte" used 4 int's work of space while "int, int, byte, byte" used 3.
    thanks - dave

    This is a quadruple crosspost.

  • JAVA-Virtual Memory Machine appears low

    Since my update to 10.5.7 neither my Safari or Firefox is able to load large charts into the Java applet. My preferences for java cache is set to max 1000mb, compression set to none. If I reduce the data and size of the chart it will load. I never had this problem before. The following message comes up:
    "Memory in the Java Virtual Machine appears low. Continuing may result in an error. Press cancel to discontinue loading of this chart."
    Previously I would just press "Continue" and the chart would load. Not anymore.
    The first plugin in my Preference list is J2SE 5.0 32-bit
    Any ideas how to rectify this? Thx.

    Going back in time to an older version does sound like it might be the solution.
    Here is the site to download a chart: http://stockcharts.com/h-sc/ui?s=nem
    First however, when the chart opens, you have to go to the bottom and change the size to 1600, then add a bunch of overlays and indicator. This will increase the memory required the the Java applet. Once that is done, you click on the "Annotate" link directly at the bottom edge of the chart (next to the Print link) and that will load it into the Java applet. The first time it should load properly, but then fail the following times.
    It will be interesting to hear about your test.
    Thx

  • Java, the memory hog......

    hi all,
    i have an application that is kb's in size but takes 70 mb of memory when it runs. the application is just a basic swing application that has nothing special. i am developing on an sgi irix system. could someone brake down what swing components takes the most memory. does anyone know of a good memory debugger for java. how would i run down what is taking so much memory. any insight into this problem would be much appreciated.

    I was making a simple application of a similar description.
    I found my problems were my use of Strings .
    within tight loops I set the string's variable to null at the end .
    I set all strings and objects to null after they are used so that they could be picked up by java's garbage collector.
    I noticed no more memory problems.

  • Java virtual memory: 16,777,216 TB!

    I've noticed some Java oddness since the latest update, but now I see that the Activity Monitor reports that it's taking 16,777,216 TB of virtual memory. Should I worry about this?

    Opening the java console and choosing a 32-bit version of Java (Apple's choice as default) will drop the VM down from the 16777216 TB (to 1.29 GB) on my computer. I have no idea what the other connotations of changing your java version are.

  • Confusion on Java heap memory and WLS_FORMS

    Hello all,
    Background first:
    Oracle Forms/Reports 11.1.2 64-bit
    WebLogic Server 10.3.6
    JDK 1.6 update 37 64-bit
    Microsoft Windows 2008 R2
    Using nodemanager to start/stop managed servers
    After having read all of the documentation and searched both this forum and the Internet for advice, I'm still utterly confused about the best way to make use of memory on the server (the server I'm working on now has 8GB). The two trains of thought that I have discovered in my search:
    1). Don't change the Javaheap size at all (stick with the defaults) and just create additional managed servers on the same machine.
    2). Increase the Java heap size for WLS_FORMS
    Having said that, here are my questions:
    A). What is the best-practices approach (#1 or #2)?
    B). If it's #2, what's the approved way to increase the heap size? I have tried adding -Xms and -Xmx arguments to the WLS server start arguments in the WLS console. These are applied when the managed server is started (confirmed in the log file), but because of the way WLS_FORMS is started, there are more -Xms and -Xmx arguments applied after mine, and Java picks the last one mentioned if there are duplicates.
    First update: Question #2 seems to be answered by support note 1260074.1 (the one place I hadn't yet looked)
    Thanks for any insight you can provide. If there's a document I've missed somewhere, I'm happy to be told where it is and will read and summarize findings here.
    Regards,
    John

    John,
    Let me try to comment on each of yours:
    1). We had been getting some "Apache unable to contact the forms server" type errors (the users were seeing the "Failure of server APACHE bridge" error). The log files showed nothing of interest. I increased the memory allocated using setDomainEnv.cmd, and the error seems to have gone away. Yes, I know that it was a shotgun approach, trying something without really having a reason to do so, but it seems to have helped Edit: Now that I review the OHS logs instead of the WLS_FORMS logs, I have found log messages, which leads me to Doc 1380762.1, which tells me I need a patch. DOH. And, oh crikey, Forms 11.1.2.1 is out, it came out shortly after we downloaded 11.1.2.0 to create these environments. Good news/bad news kind of thing... <blockquote>The Apache Bridge error is fairly straight forward if you understand what it is telling you. It is an error generated by mod_wl_ohs who is owned by OHS (Apache). This module is responsible for the connection between OHS and WLS. The Apache Bridge error means that OHS (mod_wls) was unable to get a response from the WLS managed server it was calling. Basically it was unable to cross the bridge ;) The cause could be anything from the managed server is not running, to the managed server is over tasked, or there is a network configuration issue and the managed server simply didn't hear OHS calling.
    This is all discussed in MOS note 1304095.1
    As for 11.1.2.1, this can be installed fresh or as a patch over 11.1.2.0. So for machines that don't currently have anything installed, you can go directly to 11.1.2.1 without having to install 11.1.2.0 first.</blockquote>
    2). As tony.g suggested, we are looking for what we should do to solve the "I have n servers with x GB of RAM, what should I do to the out-of-the-box configuration of Forms for stability" question. <blockquote>As I mentioned, there really are no "Forms" specific tweaks related to how much RAM your machine has. The only exception to this is (although somewhat indirect) to use JVM Pooling. JVM Pooling can reduce the size of each runtime process's memory footprint by moving its java calls to the jvm pool then sharing common requests with other running runtimes. Memory usage by OHS or the WLS managed server really has little to do directly with Forms. Specifically to the managed server, from a Forms point of view, I would not expect the memory cost of WLS_FORMS to increase much because of load. I expect it to increase as concurrent load increases, but I would not expect it to be significant. If I had to guess, seeing an increase of 1m or less per user would not surprise me (this is just a guess - I don't know what the expected values would be). If we were to use our (Oracle) older scalability guidelines, typically we would have suggested that you should consider about 100 sessions per 1 jvm for best performance. Given that v11 uses a newer java version and scalability is better today, I suspect you can easily scale to a few hundred (e.g. 300) or so before performance drops off. Beyond that, the need to add more managed servers would likely be necessary.
    This is discussed in MOS note 989118.1</blockquote>
    3). HA is important to us, so we are implementing a cluster of Forms/Reports servers with an LBR in front of it. I have read in the docs on clustering, cloning a managed server, and via Support, how to increase the heap memory for the WLS_FORMS server. My thought process was "if Oracle gives me instructions on how to increase heap memory and how to clone managed servers, there must be a scenario in which doing so provides benefit." I'm trying to understand the scenarios in which we would do either of those activities. <blockquote>Refer to the note I mentioned above. Generally, if you limit the number of concurrent sessions to less than around 300-400, I would think the default settings should be fine. If you think you would like to go beyond 300 or 400 per managed server then likely you will need to increase the max heap for the managed server. Again, refer to the note I mentioned previously.
    Also see MOS note 1260074.1</blockquote>
    I am aware of the JVM pooling (yes we do call out to Reports) - I've yet to implement this, but it's on my to-do list.
    <blockquote>This is discussed in the [url http://docs.oracle.com/cd/E38115_01/doc.111210/e24477/jvm.htm]Forms Deployment Guide</blockquote>
    Hope that helps ;)
    .

  • How to measure Java CPU & memory usage

    Hi,
    I'm not sure whether this is the right forum to post this message.
    I have a java application and basically it takes lots of CPU time and memory. What my concern right now is the CPU usage. Basically I reduced the number of CPUs from 8 to 4 (Solaris v1280 box) and the CPU usage got increased from 30% to 90% :(
    My requirement: Is there anyway that I can measure the CPU usage using Java code itself, so that I can insert those "set of APIs" (for measuring CPU usage), between APIs to collect the CPU usage data?
    Thanks,
    Siva

    Take a look at this.
    http://articles.techrepublic.com.com/5100-10878_11-6067049.html

  • How to get a java card memory size info ?

    Hi everyone ,
    I want to get my card's memory size and free memory size .I appreciate it if anyone could help me with these questions :
    1 . Is there any way to find out card's defferrent memories size (EEPROM , ROM , RAM , FLASH) from Get Data command or any other apdu commands ?
    2 . is there any function in the API which we could use to reach memory size within an applet ? I found a function named GetMemorryAccessInstance in JCRE 2.2.2 API but I need something more global for all API versions .
    3 . Which Memories size information do we have access to ?
    Best Regards,
    Shemeine

    Hi Shemeine,
    Some cards have proprietary APDU's to find the free memory on a card. Even on cards that have such an APDU, you may have to have it enabled when the card is produced.
    As for a way to find it programatically, you can use:
    JCSystem.getAvailableMemory(JCSystem.MEMORY_TYPE_PERSISTENT);
    JCSystem.getAvailableMemory(JCSystem.MEMORY_TYPE_TRANSIENT_DESELECT);
    JCSystem.getAvailableMemory(JCSystem.MEMORY_TYPE_TRANSIENT_RESET);The problem with these is they return a signed short. This will only show up to 32KB of free memory. If you have more than this, you will have to allocate some memory using new byte[32*1024] until you start seeing results less than 32KB. You then work out how many blocks of 32KB you had to allocate to reach this state. The types of memory you can find are self explanatory.
    Cheers,
    Shane

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

Maybe you are looking for