Acitve Objects in JVM

Is there any way to find the active objects in the JVM at particular point of time? All the suggestions and inputs are welcome.
Thanks in advance,
Raghu

Hi Raghu,
in JVMTI (http://java.sun.com/j2se/1.5.0/docs/guide/jvmti/jvmti.html) there is a method IterateOverReachableObjects. You can use this interface to write your own little profiler.
Nick.

Similar Messages

  • How Can i Count the objects in JVM

    Hi,
    i wanted to count the number of objects in JVM, and get some preformance information in it.... I dont want to use a Profiler to do that because i just wanted few information from the production machine... we dont want addtional work for the VM.... just wanted to write a small app which can do it... without changing any addtional settings in the existing app....
    The goal was to create a URL which will return a XML of this data which will be collected from multiple machine and consolidated for performance and capacity....
    Any help or direction to an set of API's will help.....
    Thanks and Regards
    Vijay

    Try jconsole to see if it does what you need. Visualvm in update 10 is another good tool.
    --Ray                                                                                                                                                                                                   

  • Finding Objects in JVM

    Hi,
    Is there a way by which I can get a reference to any object in JVM?
    OR
    Is there way I can get reference to all the active object instances that are currently available in the JVM ?
    OR
    Is there a way I can get a reference of all the objects active of a given class in JVM?
    For Example :
    class A {
    static void main(String args[])
    String str = new String("Test");
    class FindAObject {
    static void main(String args[])
    String strObjFound = (String) getReferenceOfObject("str");
    Object getReference(String objName)
    /*Steps/API call to get reference to "str" object of Class A*/;
    Here I am assuming that both the classes A and FindObject are active in JVM at a given time. Its really not important to find object by name ... Any other way to find objects will do.
    In one of the threads on one of the forums, I read that analyzing how various Garbage Collectors work can help ... but could not get my hands on any GC implementation.
    Thanks,
    Vinayak

    Is there a way by which I can get a reference to any object in JVM? You need to have a reference to it or something which has a reference to it etc.
    Is there way I can get reference to all the active object instances that are currently available in the JVM ?No.
    Is there a way I can get a reference of all the objects active of a given class in JVM?No. You can keep this list if you need it however.
    It sounds like what you need is either a debugger or a profiler.

  • Can I get the reference to all objects in JVM Heap?

    Hello,
    Thanx in advance for reading (and replying) to this problem.
    I need to find an object whose reference I dont have.
    I feel the best place to search for is the JVM heap.
    If I get that JVM heap, and am able to get all the objects created, I can locate the particular object that I am looking for.
    Is there a way to od this????
    Any suggestions ????
    Vikas

    JVMTI will mostly help you in this case. But i recomend you to review you application design, because such services are unsafe and rather tricky.

  • Number of Instances of any Object in JVM

    Hello Guys, Is there any way to know number of instances for any perticular class in JVM. For example i want to know how many instance of calss "Vector" are there in JVM. Can we write any program which take class name as parameter and tells the number of instances ? is there any thing readly available in some place or if some of you guys might already written.
    Please let me know, thanks.

    In the destoryMine set the object to null and
    decrease the minecount by one.I follow everything you say but this. How do you "set
    the object to null"? Could you provide some Java
    source code as an example?I guess I don't see the problem you do. Assuming Mine has a single constructor taking a String parameter, what is wrong with this:
    public class MineFactory {
        private static int counter = 0;
        public static Mine createMine(String value) {
            counter++;
            return new Mine(value);
        public static void destroyMine(Mine mine) {
            mine = null;
            counter--;
        public int getMineCount() {
            return counter;
    }? The line         mine = null; is not a problem, is it?
    -- Scott

  • Tracking size of object in JVM

    Hi
    How do i find out which objects are taking memory in JVM.

    Get a heap dump in HPROF binary format using jmap or the new HotSpotDiagnostic MBean through JConsole if your Java application is running on JDK 6 and then analyze it with the jhat tool in JDK 6 or the new HeapWalker in NetBeans 6. NetBeans 6 can also be used to get a heap dump.
    For more detailed info have a look at the Hands-On Lab I presented at JavaOne 2007 about troubleshooting Java applications:
    http://developers.sun.com/learning/javaoneonline/sessions/hol2007/1420/jmxjconsole/index.html#Exercise_2_5
    Regards,
    Luis-Miguel Alventosa
    Java SE JMX/JConsole development team
    Sun Microsystems, Inc.
    http://blogs.sun.com/lmalventosa/

  • Shared objects across JVMs?

    I'm sure this topic must come up fairly frequently, but try as I might, I couldn't find a satisfying answer for what I'm looking for.
    I have an object that loads a very large in-memory datastructure from disk early in its lifetime, after which time the datastructure is read-only.
    My application runs a number of different JVMs on my machine, and each of these JVMs has to load the same datastructure, wasting time and immense amounts of memory.
    I know I can likely improve the load time by storing a serialized version of the object itself on disk, but that doesn't help with the more serious problem: the memory usage.
    Any suggestions for a good, lightweight way to share this read-only memory across the JVMs?

    dougcook wrote:
    Brynjar wrote:
    One question though, is something preventing you from just using a database to store and serve this structure?Mainly performance. The structure gets accessed an unbelievable number of times inside an already compute-bound bit of code (that takes days to run as it is). That would also be my concern with RMI; you're right, I could serve up individual requests for bits of data (looking much like a database), but then I'd worry that the overhead of RMI would kill me. Thus the hope that I can somehow just share the read-only memory between JVMs.
    Edited by: dougcook on Feb 8, 2009 9:54 AMIf you need fast access to all of the structure in multiple applications concurrently, then I think you're out of luck using RMI as well, or any other socket based communication for that matter, for the same performance reason. How large is this structure and how is is currently loaded? Also, do the applications need to be separate? You would be able to share the memory if they were all running within the same jvm.

  • Cann't I get Graphics object in JVM?

    I developed a java stored procedure in which I want to generate a picture.
    So I use this:
    BufferedImage bufferedImage = new BufferedImage(width,height,1);
    Graphics g2 = bufferedImage.createGraphics();
    System.out.println(g2.toString());
    I can get the bufferedImage succesfully but when running to g2.toString(), NullPointerException are thrown.
    Cann't I get Graphics Object in Oracle's JVM?
    How can I develop this procedure to generate a picture which have to running background at databaserver.
    Need your help.
    Thanks.

    Hi Guoshun,
    Cann't I get Graphics Object in Oracle's JVM?As far as I know, you can't. Since Oracle's JVM is certified by SUN, it has to include all of the classes in the J2SE core libraries. However (and I recall reading this in the Oracle documentation) the graphics related classes cannot be used. Sorry :-(
    [But someone else may prove me wrong :-]
    I don't know if this will help you, but for your information, there are some examples in the book Java Servlet Programming by Jason Hunter about servlets creating images. Perhaps it will give you some ideas:
    http://www.servlets.com/jservlet2/examples/ch06/index.html
    And there is also Marco Schmidt's Java Image FAQ (which may also be helpful)
    Good Luck,
    Avi.

  • Applet in a browser page  doesn't gain focus with JVM 1.6.x

    Hi,
    I have a problem to move TAB in a IE browser page with applet in a tag object using JVM 1.6.x
    with JVM 1.5_10 or above this is possible. You can move focus between elements page and enter and exit to applet object.
    Executing the same applet with the same JVM, but after installation of the latest 1.6 plugin, when applet gains focus it doesn't release it.
    With JVM 1.6, applet can't gain focus and manage keyevents; all keyevents are intercepted from browser (eg: IE toolbar elements are activated) .
    I need to move focus on elements of browser page with tab, and enter and exit from applet to make my application accessible event not using mouse !!
    (you can watch a recorder right sample here: http://www.vista.it/ing_vista_0311_video_streaming_accessibile_demo.php)
    Note that FireFox doesn't work at all, even if bug seems fixed https://bugzilla.mozilla.org/show_bug.cgi?id=93149
    Please advise.

    Hi,
    We have found a wor around for this problem.
    The following option has been unchecked and the applet could be loaded.
    Go to java control panel
    Under the Advanced Tab
    Under the Security section
    Uncheck the last option "Use TLSv1.0".
    This makes the applet work.
    But could not understand as why this is creating a problem.
    We have tried to include TLSv1.0 in the cipher suite of our apache server, while keeping the above option in java plugin control panel checked, but even that did not solve the problem.
    Please help me of how should I proceed for this problem, as I am totally stuck.
    Thank you.

  • Memory Leak in Spawned JVM?

    I have set up the Activatable RMI example form Sun and noticed something unusual while monitoring the Windows Task Manager.
    When I run the client program for the first time two JVM's are spawned instead of one. When the client program finishes executing one JVM terminates while the other is left running. Everytime I execute the client program after that a new JVM is spawned and terminates (I assume this is the client program) while the other JVM grows by about 4-28k. Finally, when I terminate the rmi daemon the 'other' JVM terminates.
    What is running in this 'other' JVM?
    Why does it appear only after the first execution of the client program and not when the rmi daemon is started or when the setup program is run?
    How can I terminate this JVM without killing the rmi daemon?
    What is causing the memory leak?
    Any ideas would be greatly apreciated, thanks.

    Obviously the second JVM is for the Activatable object!
    OK.
    So when I run the client for the first time two JVM's are started one for the client program and one for the activatable object. When the client program finishes executing its JVM terminates. Meanwhile the activatable object's JVM still hangs around (and leaks memory).
    I don't want this JVM to hang around too long. Ideally I would like to control how long an activatable object hangs around after the client is finished with it. Is there anyway to shutdown the activatable Objects JVM programatically?

  • Large and long lived objects, heap vs. NIO?

    Hi,
    Our application keeps large number of objects in cache (based on Oracle Coherence) and objects are related to subscriber information which means they are supposed to stay in cache for very long time.
    The heap size we are looking at is about 3+ GB and probably the majority of the heap will be used to hold the cached objects. Is there anyway to let JRockit GC know about the 'cache' concept so it won't spend too much effort on these 'cached' objects?
    Any JRockit tuning tips for this kind of application?
    Is NIO a better approach means use the NIO to hold the cache objects rather than heap?
    But every NIOed object also consumes some heap (create Java object) at least in the Sun HotSpot implementation, not sure what is the trade-off. What is JRockit standing point on NIO given its superior GC to Sun HotSpot, because JRockit's 'guaranteed pausetime' and be able to large heap size at the same time?
    NIO seems to allow go beyond the traditional problem long pause concern when heap size is large.
    Our application is supposed to handle at least several hundred GB in distributed configuration (cluster based on Oracle Coherence).
    Is this thing JRockit may or may not have advantage/disadvantage?
    We heard about 'distributed GC' in distributed environement meaning the dependency on other JVM may cause one local GC to depend on the remote GC on the remote node if GC happens at the same time on different nodes. Any thought from JRockit perspective?
    Regards,
    Jasper

    Thanks a lot, Stefan
    I appreciate the extra miles you went beyond just the JRockit...
    One clarification in my original question, actually I mean a large number of objects rather than large-sized object. The objects range from 50 bytes to a few kb and the total number of objects are lilley in several millions.
    We have been testing Heap vs. NIO based on Sun JVM.
    But we are not able to see clear advantages one over the other at this point.
    -Using NIO does use less heap but the overall process memory between HEAP and NIO is not much different in our case.
    -Our original thinking to use NIO is because we want to cache more than 2+GB of objects per JVM so we can make good use of standard server configurations (8/16 cores 32/64G RAM) without huge number of JVMs. We're targeting 100+ million subscribers in the telecom space. The 2 GB is basically the limit that normal GC (HotSpot) probably can handle without causing long pause, otherwise it will break our SLA (latency requirement is in the ranage of milliseconds).
    -From reading the HotSpot JVM, it turns out using NIO is not totally HEAP-free meaning, additional book-keeping for the NIO resident objects are created in the form of Java objects which consumes heap too. So GC is not totally immuned. Also there are some more overheads in handling the NIO objects (create/delete) via the JNI calls.
    -Even though we are not using NIO directly, we use Coherence and Coherence provides the HEAP and NIO options for the cached objects, but ultimately it's up to JVM. Therefore I try to bring this up with JRockit. I think the NIO size limit is probably due to one direct memory allocation can be up to 'int' can cover, but if one allocation call is not big enough, multiple allocation calls should do (probably more complex/effort...). But 'int' is up to 4GB and is already good enough in our case for a JVM caching objects in NIO.
    -Our ultimate decision is based on TCO, low CPU/memory with high throughput and low latency meet the SLAs.
    We will come back to share our test results based on JRockit RealTime later and may ask for more of your insights then.
    Best Regards,
    Jasper

  • URGENT: JVM versus Microsoft VM

    hi,
    we have an application that works with applets. This application is installed locally to the users drive and runs from there. We use the java plugin for this (version 1.4.1).
    Now we're facing the problem that some users already have the Microsoft plugin installed which they need to use for other applications. However, when they install our JVM the other apps no longer work. Furthermore our application doesn't work with the MVM, I think because of one of the following 2 reasons:
    1) the security settings: easy to do with the JVM (change the java.policy) but how in earth do you do it for the MVM?
    2) the fact (is this so?) that MVM uses something like JDK version 1.1
    My question, apart from the two above, is: how can we solve this problem. How can we get our application to work with the MVM or how can you make the other apps work with the MVM and ours with the JVM (can they co-exist)?
    Dollars for anyone who gives me something to work with!
    tx very much,
    Stijn

    Hi
    You can set the security settings for Internet(Zone 3) for MVM by
    modifying the registry key:
    HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\3
    For more information on security zones in IExplorer take a look at:
    http://support.microsoft.com/default.aspx?scid=KB;EN-US;q182569&
    The Java Permissions setting (1C00) has the following five possible values (binary):
    Value Setting
    00 00 00 00 Disable Java
    00 00 01 00 High safety
    00 00 02 00 Medium safety
    00 00 03 00 Low safety
    00 00 80 00 Custom
    If Custom is selected, it uses {7839DA25-F5FE-11D0-883B-0080C726DCBB}
    to store the custom information in a binary blob.
    One possible way (for unsigned content or signed content) is to do this manually
    (on your machine)from Tools->Internet Options ... and then
    export the branch (using regedit to a .reg file for example).
    Your installation process will merge the exported key with the registry
    on the user's local machine.
    On my machine (Win2000 Pro) the Zone\3 key .
    with all the java permissions disabled and custom selected looks like this:
    [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\3]
    "1C00"=hex:00,00,80,00
    "{7839DA25-F5FE-11D0-883B-0080C726DCBB}"=hex:30,82,01,ca,03,02,00,00,30,82,01,\
    c2,30,81,cc,06,0a,2b,06,01,04,01,82,37,0f,03,01,30,81,bd,06,09,2b,06,01,04,\
    01,82,37,0f,01,31,81,af,30,81,ac,03,01,00,30,81,a6,a0,20,30,1e,06,09,2b,06,\
    01,04,01,82,37,04,04,30,11,01,01,00,30,08,14,06,61,70,70,6c,65,74,30,00,30,\
    00,a0,17,30,15,06,09,2b,06,01,04,01,82,37,04,07,30,08,03,02,00,01,03,02,00,\
    02,a0,11,30,0f,06,09,2b,06,01,04,01,82,37,04,0c,03,02,00,02,a0,21,30,1f,06,\
    09,2b,06,01,04,01,82,37,04,01,30,12,01,01,ff,01,01,00,01,01,00,01,01,00,01,\
    01,00,01,01,00,a0,17,30,15,06,09,2b,06,01,04,01,82,37,04,02,30,08,01,01,00,\
    01,01,ff,30,00,a0,1a,30,18,06,09,2b,06,01,04,01,82,37,04,03,30,0b,01,01,00,\
    01,01,00,02,01,00,14,00,30,81,cc,06,0a,2b,06,01,04,01,82,37,0f,03,02,30,81,\
    bd,06,09,2b,06,01,04,01,82,37,0f,01,31,81,af,30,81,ac,03,01,00,30,81,a6,a0,\
    20,30,1e,06,09,2b,06,01,04,01,82,37,04,04,30,11,01,01,00,30,08,14,06,61,70,\
    70,6c,65,74,30,00,30,00,a0,17,30,15,06,09,2b,06,01,04,01,82,37,04,07,30,08,\
    03,02,00,01,03,02,00,02,a0,11,30,0f,06,09,2b,06,01,04,01,82,37,04,0c,03,02,\
    00,02,a0,21,30,1f,06,09,2b,06,01,04,01,82,37,04,01,30,12,01,01,ff,01,01,00,\
    01,01,00,01,01,00,01,01,00,01,01,00,a0,17,30,15,06,09,2b,06,01,04,01,82,37,\
    04,02,30,08,01,01,00,01,01,ff,30,00,a0,1a,30,18,06,09,2b,06,01,04,01,82,37,\
    04,03,30,0b,01,01,00,01,01,00,02,01,00,14,00,30,22,06,0a,2b,06,01,04,01,82,\
    37,0f,03,03,30,14,06,09,2b,06,01,04,01,82,37,0f,01,31,07,30,05,03,01,00,30,\
    00
    I did 2 exports one with all the permissions (i.e. "Access to All files",
    "Access to all Network Addresses") enabled, the other with all of them disabled.
    By importing the files into the registry I enabled and then disabled all the java permissions.
    Regarding the 'Use Java 2 version for <applet>' checkbox.... If UNCHECKED the mvm will be launched
    for the following html code:
    <APPLET code="Applet-name.class"  width=500 height=500>
         <param name="param1" value="value1"/>
    </APPLET>For:
    <OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" WIDTH = 695 HEIGHT = 525
                   codebase="http://java.sun.com/products/plugin/1.3/jinstall-13-win32.cab#Version=1,3,0,0">
         <PARAM NAME = "CODE" VALUE = "SimpleApplet">
         <PARAM NAME="type" VALUE="application/x-java-applet;version=1.3">
         <PARAM NAME="scriptable" VALUE="false">
         <param name="param1" value="value-for-param1"/>
    </OBJECT>the jvm 1.3 will be called to execute the applet code. If your browser doesn't behave this
    way your registry settings may be messed up.
    Let me know if this solves your problem
    Regards
    BG

  • Pass non-serializable objects over sockets

    I am working with a non-serializable class.I can't change it to serializable(since it's an API class).I can't create a subclass either as I need to pass the same exact Object .I have tried wrapping it in a serializable class (as transient )but then the particular object that I need is not serialized.Is there a way to pass non-serializable objects over sockets?.Some other way of doing this?.

    Have you considered leaving it in situ and using RMI to manipulate it remotely ?
    To be a little pedantic, if you need the "same exact object" then there's no technique that will work for you, since you can only copy an object between JVMs, not move it.
    D.

  • Object Singletone

    Hello guys, i�m from Brasil , Sorry my english is bad.
    I have Objects singletone and i have two applications Server(JVM).
    When i update one object in jvm the another object is dont updated because it is in another jvm. How do i do to synchronized the objects.
    Example.
    Jvm 1 Jvm 2
    Object1 Object1
    Update
    Jvm 1 Jvm 2
    Object updated Object

    Look at http://www.theserverside.com's patterns discussions as they talk about creating singleton in a distributed environment.
    Chuck

  • JDI and object instances

    Hi,
    I'm having trouble at finding the instantiated objects in JVM.
    What would be the best way to find objects that are instantiated?
    Thank you,
    - Sami

    Are you using the jdb or are you coding with the JDI? I don't know how or if you can with the jdb, but I'm pretty sure there's a way with the JDI.
    A rubbish way would be to go through all of the threads in the JVM, then get all the stackframes on each. Then call thisObject for each stackframe. if the object has been instantiated (this works even if this stackframe being created for a static or native method) - since you won't be returned null. Then you can analyse the objectreference however you want e.g. get its name and stuff.
    Sorry - I don't know if any of that helps -
    I recommend taking a look at the source code of the JDB if you want to get into using the JDI to debuging java programs.
    Anyhus - have a good day!!
    - Edd

Maybe you are looking for

  • Report: PO with delivery date

    Hi friends, I want to see the purchase orders for which the delivery date is over but item is not supplied yet. Is there any standard report for this?

  • Download to excel - class not found error

    hi all i m trying to provide a feature in my project called download to excel. I have written the code and referenced appropriate jars still on deployment i get the no class def found error. Pls help. regards vln

  • Missing popup - FIND VARIANT

    Hi, I created a Z program and has selection screen variants for 3 users.  When I press the variant button on selection screen, popup FIND VARIANT is not displayed  to search a variant with search parameters (Variant, Environement, Created by..etc.).

  • Help with Playbook

    I bought the BB Playbook recently.It came with OS ver 1.08 on it. Used it for a couple of ,connected to my windows Desktop manger(latest ver) for backup.Then new OS was released.Updated to OS 2.0 OTA.Now i am inable to connect my playbook  to desktop

  • How to get rid of Gracenote

    Yesterday was asked if i wanted to have Gracenote on my iTunes via a pop up. As it was lettered as if it were from Apple i agreed. Now unable to import CD to my music...and closes down itunes. I want to get rid of it. Have found forums with people wi