Explicitly tagging an object as unused

Just read an article on gc tuning (http://www-106.ibm.com/developerworks/java/library/j-perf06304/?ca=dgr-lnxw07BlogFix)
where memory leaks are caused by the so called "unintentionally retained objects".
Currently, detecting memory leak in Java is done using memory profiler to monitor
memory usage and select which objects are suspected to cause of memory leaks.
Then, the programmer must decide/guess which of the suspected objects really cause
memory leaks.
Is it worthed to provide an API that explicitly tags an object as unused, so that memory
profilers can find which objects are 100% the cause of memory leak? The notion of this
API is similar to free in C, however, this API does not affect the decision made by gc
regarding the reclaimability of an object, nor does it force gc to reclaimed the object.
Object marked by this API means "I'm no longer needed by the user/program/algorithm.
Hence, I should be able to be reclaimed by gc. If gc deemed I'm still referenced, this
means the programmers make mistakes, and thus, they must fix the program".

Just read an article on gc tuning where memory leaks are caused by the so called "unintentionally retained objects".Quote: From the final memory profile (Figure 3), with the major memory leak eliminated, we can see that there still is another "low grade" leak, but this leak is small enough that it can be ignored until the next release.
If you are getting memory management advice from articles by people who are happy to release software that they know is leaky, then you're in trouble. (OK, so my background is flight control software where leaks would be a matter of life and death, but these people seem to have no sense of personal honour.)
Currently, detecting memory leak in Java is done using memory profiler to monitor memory usage and select which objects are suspected to cause of memory leaks.Only do what is necessary to perform the required functionality. If having a reference to an object is functionally necessary, then that reference is required and will not be a leak. If you have a reference that is not required for the functionality, then you shouldn't have that reference any more. Cases where performance requires that a value be cached in case it is may be needed are already catered for with the WeakReference and SoftReference APIs.
Is it worthed to provide an API that explicitly tags an object as unused, so that memory profilers can find which objects are 100% the cause of memory leak? No, for the same reason that there is no goto in Java. If you are writing software that is so convoluted you don't know what objects are referencing each other, adding an API that encourages you do that more will not help you.
If gc deemed I'm still referenced, this means the programmers make mistakes, and thus, they must fix the program".If you are debugging badly written code, and do not have access to a static analysis tool which will tell you where your objects are being referenced, then you have the option of creating a reference queue and a phantom reference to your suposedly unreferenced object, clearing all references in your algorithm, forcing gc, and then asserting that the phantom reference was cleared.
Pete

Similar Messages

  • applet tag vs Object tag

    As per W3Schools HTML applet tag is not supported in HTML5. Need to use <Object> tag instead of <applet> tag.
    For more details follow this link: http://www.w3schools.com/tags/tag_applet.asp
    http://dev.w3.org/html5/spec/obsolete.html#the-applet-element
    Point 11.2 Non-conforming features
    So, I go ahead and the change the code as below depicted.
    Below code that is working with <APPLET> tag:
    +<Applet+
    style    = "position:absolute;border:0px;left:184;top:95;height:180;width:364;"
    code     = "jtreeviewapplet.JTreeViewAppletMain.class"
    name     = "TreeView"
    id       = "TreeView"
    hspace   = "0"
    vspace   = "0"
    align    = "top"
    archive  = "/Project/HTML/ABC/XYZ.jar,/Project/HTML/ABC/ABC.jar"
    MAYSCRIPT>
    +<PARAM NAME="onSelected" VALUE="onSelect_Handler">+
    +<PARAM NAME="onFinishNormalize" VALUE="onFinishNormalize_Handler">+
    +</Applet>+
    Here is the snippet, whcih have been changed to <OBJECT> tag so as to support HTML5 in future:
    +<OBJECT type=" application/x-java-applet"+
    style    = "position:absolute;border:0px;left:184;top:95;height:180;width:364;"
    name     = "TreeView"
    id       = "TreeView"
    hspace   = "0"
    vspace   = "0"
    align    = "top"
    +>+
    +<PARAM name="code" value=”jtreeviewapplet.JTreeViewAppletMain.class”>+
    +<PARAM name="codebase" value="/Project/HTML/ABC/">+
    +<PARAM name="archive" value=" XYZ.jar">+
    +<PARAM name="archive" value=" ABC.jar">+
    +<PARAM name="scriptable" value="true">+
    +<PARAM NAME="onSelected" VALUE="onSelect_Handler">+
    +<PARAM NAME="onFinishNormalize" VALUE="onFinishNormalize_Handler">+
    +</OBJECT>+
    After changing the *<applet>* tag to *<object>* tag , my applet itself is not loading and it gives class not found exception for jtreeviewapplet.JTreeViewAppletMain.class.
    (Note: For both working and not working condition, I am using latest JDK 1.7 update 9 for compiling the code and in my system I am having latest JRE1.7 update 9 to run the applet code. I am using InternetExplorer 8 and InternetExplorer 9 browser)
    Can anybody help me to find out where I am going wrong?
    Edited by: 975931 on Dec 12, 2012 1:24 AM

    You might want to stick to the documentation:
    http://docs.oracle.com/javase/tutorial/deployment/index.html
    and use the deployment toolkit.
    PS: use \ tags when posting anything code related. That makes it readable and it keeps the forum from trying to interpret it.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Untagged physical object must be assigned to a tagged parent object   ?

    Hi friends ,
    I am using Auto-ID Test tool  as simulattor  of Device Controller  . When i tried to trigger Tag commissioning from AII , I have sent the proper informations like GTIN , Device Controller ID , command etc.,
            It is triggering the rule TAGCOM_AA but i was getting the error at the activity POBJ_CREATE as   " Untagged physical object must be assigned to a tagged parent object  "
        If i do the tag commissioning via  Auto-ID Cockpit it correcly processing and sending the XML message to the appropriate destination .
        Please clarify !
    Thanks & regards.,
    V.Rangarajan

    Hi  Michael,
    Thank you very much for your valuable answer . But, i  stuck up   at the printer assignment .
    My question is
    1.If Tag commissioning will be taken care by the Device Controller ( Not by AII ) but command has to go from the AII to device controller .  If assign the printer  to  device group then AII will send directly  print command to Printer right ?
             Please clarify the Printer assignment steps .  I have referred the Slap and Slip configuratuion Guide but still doubt
         1. In Device Master Data Settigns - under Device Group Settings i have done as
    AII_DC     WRITE_DEV_GRP     Writer     Fixed Device     Tag Commissioning     Door     WRITE_STATION
        But i have not assigned the Printer , Where to Define this printer is it  RFC Destination ?  Pls , clarify this point .
       2. If i do that Tag commissioning via Auto ID ****  pit  AII is sending  Print  Command Message to the Device Controller (RFC Destination - which is assigned to the Device Controller )
      Once agin thanks for the good reply .
    Thanks  & regards.,
    V.Rangarajan

  • Explicitly extending the Object class

    Hi Everyone,
    I am aware that every object that is running inside a JVM inherits from class Object implicitly. Recently I have come across some code that explicitly extends the Object class, is there any advantage in doing this, please see the code snippet below:
    public class MyClass extends Object{}Thanks heaps for your assistance.
    Regards
    Davo

    I've even seen a
    method that was declared "throws NullPointerException"shouldn't it have been "throws java.lang.NullPointerException" ...
    - I almost cried. Yes, thats truly a terrible habit :(
    a distant cousin of that habit is one I have noticed where the developer
    is totally unable to name anything appropriately..
    to print some things to the screen: "loadData"
    to print things to screen again: "getInformation" *(note: did not 'return' anything).
    ... :(

  • Custom Tag using object as an attribute.

    I have read up on trying to pass an object as an attribute to a custom tag.
    Is it true that the only way to do this is to put the object, using a "key name" in the pageContext
    Then in the custom tag, set an attribute equal to the "Key Name"
    Then in the TagHandler, to do a lookup using the "Key Name"
    We can not just past objects into the attribute?
    And what is this about using EL or JSP2.0
    sorry sort of new to the whole game.

    Certainly you can pass objects to tags.
    However you need to use a runtime expression to do that.
    such as <%= expr %> or (with JSP2.0) ${expr}
    If you look at the JSTL library, it uses the EL and passes in objects all the time. However the EL actually accesses the page/request etc attributes as its variable space, so you are still technically using attributes.
    Is it true that the only way to do this is to put the object, using a "key name" in the pageContext
    then in the custom tag, set an attribute equal to the "Key Name"
    then in the TagHandler, to do a lookup using the "Key Name"That is one way of doing it. The struts libraries use this method extensively. It is more suited to JSP1.2.
    Sometimes it is easier/neater just to put the value into a scoped attribute, and pass in the name of that attribute. That way you don't need to worrry about the type of the attribute at all in your JSP.
    Hope this helps some,
    evnafets

  • Explicitly destroy an object in ABAP

    Hi,
    i like to destroy an Object explicitly. After the paricular statment the object must be destroyed.
    if i set the reference of the object to null.when the object will be deleted? immediately or during automatic garbage collection.
    Thanks and regards,
    Prakash.

    Hi,
    you can do in OLE also.
    INCLUDE OLE2INCL.
    DATA EXCEL TYPE OLE2_OBJECT.
    CREATE OBJECT EXCEL 'Excel.Application'.
    FREE   OBJECT EXCEL.
    in OO ABAP
    FREE OBJECT <b>OBJ</b> .
    here OBJ is object reference to some class.
    Regards
    Vijya

  • Applet tag and Object tag.

    Hi All,
    My application is hanging which is using Applet.I have specied in IE settings to use Sun's JVM[plug in].Applet tag is now depricated they [W3c] recommend to use Object tag for IE.Is my problem somewhere related to this?what difference does it make.?Please help me its very urgent.
    Cheers:
    Akash.

    Currently the applet is running through Applet tag.my application is using As400 emulator tn5250j which i am showing through Applet.The second frame is showing images. After entering data in As400 screen i am submitting data through submit button which is on second frame.but after submitting applet screen got hung.dont know the reason code seems to be fine.no memory leakages.
    thx for reply.

  • JSP tags as object constructors?

    Hi,
    I want to instantiate an object in a tag handler and then use the object in my JSP code. For example:
    <objConstructor varName="myObj" field1="foo" field2="bar" />
    <%
    out.println(myObj.getField1() + " " + myObj.getField2());
    %>
    Is there an elegant way to do this in JSP, or is there a more appropriate way? I want to allow non-programmers to edit the stuff.
    Thanks,
    Greg

    Sure, you just need to add a TEI class for your tag. So if your tag class is named ObjConstructor.java, you'd need a class called ObjConstructorTEI.java that looks something like this:
    import javax.servlet.jsp.tagext.*;
    public class ObjConstructorTEI extends TagExtraInfo
       public VariableInfo[] getVariableInfo(TagData data)
          VariableInfo info1 = new VariableInfo(data.getAttributeString("id"),"class.name.for.the.object", true, VariableInfo.AT_BEGIN);
          VariableInfo[] info = { info1 } ;
          return info;
    }Note: I changed your varName to id in this example, just to follow the convention used by other tags like jsp:useBean.
    I copied it from a tag I wrote a while back, so I don't remember the specifics of the VariableInfo API, but since you're using it the same way as I did, it should work.

  • Map tags to object styles?

    Hello ID users & developers!
    Well, now i know that tags from imported xml can be mapped to corresponding paragraph or table styles of ID document.
    But, if i have to map any tag to an object style?
    I import images with <Image href='image_path' /> tag.
    Now, how can i bind it to Image object style?
    Thanks in advance, Alex.

    It does not.
    It would be nice though some day.

  • Problem in tagging the object to Transport Request

    Hello Experts,
    I have installed 0FISCVARNT using BI Content, but when i try to change the package of the standard object and save it under TR, it is not allowing me to change the package from local class.
    Please provide me any suggestions, if you have any.
    Thanks
    PT

    Hi PT,
    What are all the steps you have tried I am not aware of, but you can try following options.
    1) Goto SE03 transaction, on the left hand side tree you have the option "Change object directory entry". Select that option put eh object type as R3TR IOBJ and your info object name. Just execute and you should be able to change the package from local to any other transportable package.
    2) Go to RSD1 and give info object name, goto change option and I am not remembering in the EDIT or menu beside EDIT you will have the option to change the  "Object Directory Entry", there also you can change package from local to transportable package.
    Regards,
    Durgesh.

  • Conversion of files to PDF/A

    I have been spending a lot of time lately trying to ensure that an important document can be 'archived', i.e. opened at a later date looking exactly as it should, without relying on external files (e.g. fonts) not embedded in the PDF.  Essentially this means making the PDF PDF/A compliant (specifically PDF/A1b is sufficient for me).  I created the original file (not PDF/A-compliant) for printing with Acrobat 7 Pro (v7.1.0).
    There were two problems here:
    * the PDF/A standard had only been drafted when Acrobat 7 was released;
    * all my efforts to recreate a visually-identical PDF file (PDF/A-compliant) using Acrobat 9 Pro (v9.1.0) from the original source files (MS Word) failed.  There were always visual differences.  E.g. http://forums.adobe.com/message/1931760#426522.
    The next option, therefore, was to convert the general PDF to a PDF/A-compliant format. This means flagging it as PDF/A-compliant, embedding fonts, etc.  Critically, it also requires a character-ID to glyph-ID map (CIDtoGIDMap).
    I had previously trialled the pdfaPilot plugin (from Callas Software) from within Acrobat 7 Pro, and this also couldn't quite manage.  Nevertheless, it did a better job than the Preflight conversion using Acrobat 9 Pro on it's own, which couldn't seem to fix the CIDtoGIDMap problem(s).
    I have just attempted a conversion on the same stubborn file with pdfaPilotServer (standalone application from Callas Software), and this seems to have done the job of making the file PDF/A-compliant (for archiving).
    —DIV

    In a post above I complained that Callas' pdfaPilot Server did not (by default) set the output intent as sRGB. This seems to have been a case-specific problem, where the sRGB output intent was not specified in the original (non-PDF/A-compliant) PDF.  Although colours were used in the document, pdfaPilot Server opted to set the parameter "Color space of data" as "GRAY", instead of "RGB ".  Having said this, I should point out that this had no apparent ill-effect on the display of the now PDF/A-compliant document.
    Nevertheless, the PDF/A-compliant status was lost by inserting an explicitly-tagged RGB object into the PDF document, namely a 'Sticky Note' comment using Adobe Acrobat.  Running pdfaPilot Server over the modified file restored PDF/A-compliant status, and now recognised "Color space of data" as "RGB ".
    Alternatively, I could have avoided the need to convert twice by overriding the default settings using a command "--outputintent="<path to sRGB Output Intent file>"".
    A key point is that Adobe Acrobat 9 Professional (v9.1.0) was in each case either (i) unable to achieve PDF/A-compliance or (ii) achieved compliance, but in the process altered the appearance of the document (including placement of black text).
    While pdfaPilot can be improved in some areas, such as perhaps the colour detection, I especially commend Callas Software for their prompt and helpful attention to technical enquiries.
    —DIV

  • Xcelsuis SWF - Not able to open in browser using Object TAG

    We want to open Xcelsuis analytic form outside InfoView, by providing user an option to click on link to open analytic directly from application.  We used SSO and Object tag in our custom JSP page. We were able to successfully pass SSO but couldnu2019t load SWF file. Although there wasnu2019t any error in browser while loading JSP page, but Adobe Flash object returns message that movie can't be loaded.
    Open Xcelsuis SWF using documentDownload and passing FlashVars like CELogonToken and CEWebServiceURL.
    Following are the steps:
    u2022     Created JSP file, which first generates logonToken and store in some variable.
    u2022     Generated Flashvars variable using following code:
    String Flashvars = "CELogonToken=" + Encoder.encodeURL(CELogonToken);
    Flashvars+= "&CEWebServiceURL=" + Encoder.encodeURL("http://winiadv22.ams.com:9085/dswsbobje/services/session")
    u2022     Used Flashvars in Object tag.
    <OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase=                                                         "http://fpdownload.adobe.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" WIDTH="100%" HEIGHT="100%" id="myMovieName">
                   <PARAM NAME="movie" VALUE= ="../../opendoc/documentDownload?iDocID=18094&sKind=Flashu201D> <PARAM NAME="quality" VALUE="high"> <PARAM NAME="bgcolor" VALUE="#FFFFFF">
                   <PARAM NAME="play" VALUE="true"> <PARAM NAME="loop" VALUE="true"> <PARAM NAME=bgcolor VALUE="#FFFFFF">
    <PARAM NAME=FlashVars VALUE="<%=Flashvars%>">
                   <EMBED src="../../opendoc/documentDownload?iDocID=18094&sKind=Flash" FlashVars="<%=Flashvars%>" quality=high bgcolor=#FFFFFF WIDTH="100%" HEIGHT="100%" NAME="myMovieName" ALIGN="" TYPE="application/x-shockwave-flash" play="true" loop="true" PLUGINSPAGE=
                           "http://www.adobe.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">
                   </EMBED>
              </OBJECT>

    Have you set up a wildcard DNS entry for the spapps.com domain?
    Also if you're trying to connect from the server you might be hitting loop back check issues.

  • How to embed jnlp file into html page using object tag

    hi everyone,
    i have written one jnlp file like this.
    <?xml version="1.0" encoding="utf-8" ?>
    <!-- JNLP file for Demo applicaion -->
    <jnlp spec="1.0+" codebase="http://localhost:9080/base/" href="SampleExample.jnlp">
         <information>
              <title>Demo Application</title>
              <vendor> </vendor>
              <description>Sample Demo Application</description>
              <offline-allowed/>
         </information>
         <security/>
         <resources>
              <j2se version="1.3+" />
              <jar href="common.jar" main="true" download="eager" />
              <jar href="classes12.jar" download="eager" />
              <jar href="toplink.jar" download="eager"/>
              <package name="com.applet.*" part="applet" recursive="true"/>
         </resources>
         <applet-desc name="grid" main-class="com.applet.PriceGrid" width="1000" height="300"/>
    </jnlp>
    i am trying embed that jnlp file using object tag like
    <OBJECT
    classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" WIDTH="1000" HEIGHT="300" NAME="grid">     
    <PARAM NAME="jnlp" VALUE="http://localhost:9080/base/SampleExample.jnlp">
    </OBJECT>
    but i am not able to load the applet using Web Start.
    Can anyone please help me. This is very Urgent for me.
    Thanks & Regards,
    Shiva.

    thanks.
    i am giving my problem clearly. i have one applet. Previously i am loading the applet in my html page using object tag like this...
    <OBJECT
    classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" WIDTH="1000" HEIGHT="300" NAME="grid">
    <PARAM NAME="CODE" VALUE="com.adp.base.applet.PriceGrid.class" >
         <PARAM NAME="ARCHIVE" VALUE="common.jar,classes12.jar,toplink.jar" >
         <PARAM NAME="NAME" VALUE="grid" >
    <PARAM NAME="type" VALUE="application/x-java-applet">
    <PARAM NAME= "cache_option" VALUE ="no">
    </OBJECT>
    now what i need to do is
    i need load the applet only first time using web start and when ever the applet code changes in the server i need to reload the applet.
    for that i kept all the applet resources in .jnlp file.i want to cache all the resources which are in .jnlp file and applet must be displayed within a web page within a browser.
    Webstart always open a new application windows.
    I need to run an Applet embedded within a web page within a browser.
    Is there a way to still use Webstart?

  • Inserting Flash Problem no ID in the object tag

    Notice the id property in the object tag.
    <object
    classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
    codebase="
    http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#ve
    rsion=7,0,19,0" width="550" height="400" id="source2">
    Well Contribute is not inserting this tag. Therefore the
    flash movie will not
    run the folowing (Flash Action Script):
    import flash.external.ExternalInterface;
    theURL = ExternalInterface.call("getLocation");
    Anyone know what to do?

    this post already this repeating with this goes 2 times in
    that link is the same post
    http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?catid=303&threadid=1162346&en terthread=y

  • How do i destroy an object explicitly ?

    I need to explicitly destroy an object ... how do i do it ?
    1) set object to null
    2) call finalize on the object
    3) ur suggestion pls...

    I need to explicitly destroy an objectNo, you don't.
    ... how do i
    do it ?You can't.
    1) set object to nullObjects are never null. Only references can be null. If you set the only reachable reference to the object to null (or to any value other than pointing at that object), then the object becomes eligible to be garbage collected. When--or if--it actually gets cleaned up is beyond your control, but it's guaranteed to happen if the memory is needed.
    2) call finalize on the objectNo. Never call finalize. The GC calls it for you. (And you should rarely if ever override finalize.)
    3) ur suggestion pls...Read up on Java's garbage collection so that you understand why you don't need to do this.
    This article is about something else, but it starts off with a decent intro to GC. You can also google for java garbage collection tutorial or something.
    http://java.sun.com/developer/technicalArticles/ALT/RefObj/

Maybe you are looking for

  • Why will itunes not install on my windows 8.1 machines

    I've tried 4 times to install iTunes on a new Sony windows 8.1 machine but it keeps telling me that the program is incompatible.  I have been using iTunes for years and had it on my old machine running Win 7.  With win 8.1 I keep getting error msgs t

  • Invoice is not getting printed for particular 3 customers

    Hi, When user is printing the Invoices, only for specific 3 customers it is it not getting printed automatically, but the output is shows success with green. When they re process it manually, it is printing successfully for the same printer. 1. Print

  • How can I convert date infomation to a string just includes the date not th

    I just want the date like Thu 08, july 2004 but not the exact time. how can I do that.

  • Yoga 2 Pro - Wake From Sleep Issue

    Hey Guys, Just recently purchased a Y2P (i7 256gb) less than a week ago. The issue i am currently experiencing is when i wake the laptop from sleep, usually at least 15 mins of sleep, the laptop will come up but then the system is considerably laggy/

  • Problem in Applicant mail assignment

    Hi Friends ,                  i am facing a problem in  sending the mail to Applicant   when we the initial data entry is done. the error message is as below " this standard text does not have the correct format for sapscript" similarly in Applicant