Dispose a user-defined object in Java

Hello,
Suppose I have the following loop :
while ( some_condition) {
UserDefinedClass abc = new UserDefinedClass();
// do some work and exit loop.
Everytime, I enter this loop I instantiate a new object "abc". I am worrying that if I keep doing this, after a while, I will run out
of memory. Is there a way to dispose a user-defined object? Or is this scenario taken care of by Java garbage collection process?
Any advice is much appreciated.
Akino.

Akino wrote:
Hello,
Thank you for your reply.
I wonder if you could tell me how often Java does its garbage collection?That's pretty unpredictable.
I ran a test and observed that
my program's memory usage kept going up and up.If you gave it it 64M, and the most it ever needs at one time is 10M, it can still ramp up to the full 64M, even if it's doing frequent GC. Running GC does NOT mean that the JVM gives the memory back to the OS. It can do that, and I think it does under some circumstances, but there's no guarantee if, when, or how much it will give back. GC only means that the JVM has reclaimed space that is no longer in use by objects. Whether it holds onto that memory for future use or gives it back to the OS is up to it.

Similar Messages

  • How can i send user defined Object as a argument to the MBean methods in authentication provider to create user?

    I developed our own Authentication, Identity Assertion & Authorization providers
    for weblogic 8.1 SP1. In the authenticator MBean i have one method which takes
    user defined object as a argument and returns a user defined object. i am able
    to call all the methods which takes java objects(for example: String, int, ArrayList,
    HashMap, Etc...) as a argument and returns also a java object but when i user
    any user defined object then it gives exception. if in the argument i used user
    defined object then it is not able to call that method telling NoSuchMethodException.
    Is there any way to use user defined object as an argument to MBean method?
    can anyone please help us as we r in the final stage of the project?
    Thanks
    Lakshmi

    "Lakshmi Padhy" <[email protected]> wrote in message
    news:3fc2f50c$[email protected]..
    >
    I developed our own Authentication, Identity Assertion & Authorizationproviders
    for weblogic 8.1 SP1. In the authenticator MBean i have one method whichtakes
    user defined object as a argument and returns a user defined object. i amable
    to call all the methods which takes java objects(for example: String, int,ArrayList,
    HashMap, Etc...) as a argument and returns also a java object but when iuser
    any user defined object then it gives exception. if in the argument i useduser
    defined object then it is not able to call that method tellingNoSuchMethodException.
    >
    Is there any way to use user defined object as an argument to MBeanmethod?
    >
    I seem to remember that jmx only supports scalar datatypes. Ask in the
    weblogic.developer.interest.management newsgroup.

  • EJB : How to return user defined object

    hi,
    i am a newbie in EJB. i have the following simple problem:
    public interface MyApp extends EJBObject
       public String getResult() throws RemoteException;
    }the above code will be ok because it is returning String object.
    however, i need to return a user defined object like:
    public interface MyApp extends EJBObject
       public MyResult getResult() throws RemoteException;
    }then i got java.lang.ClassCastException during runtime.
    please tell me how to resolve this problem.
    thank you very much

    since you are a newbie, let me explain something to you. Ask your question in the proper forum. In case, you still don't understand there is a forum for EJB questions.

  • Object to user defined object

    I pushed user defined objects in to the Vector or Stack.
    But they return an java defined Object type when I try to use them.
    Is there way that I can convert this Object into my defined object.
    MyClass a;
    MyClass b;
    Stack table = new Stack();
    table.push(a);
    table.push(b);
    //now when i use pop to get it back it returns an Object type
    Object temp = table.pop();
    //how do I change this object into MyClass so i can have access to MyClass stuff?

    dam..thank you so much I feel stupid..Don't.
    Casting is one of those things that can take a while to get used to.
    In your original post, you asked: how do I change this object into MyClass so i can have access to MyClass stuff?
    It's important that you understand that casting doesn't change the object in any way.
    All it does is cause a reference that's been declared as one type to be treated as a different type. So even though all the compiler knows about what's returned from pop() is that it refers to an Object, you're telling it you know better, and that the object pointed at will in fact be a MyClass, and so you can access MyClass' members.
    If, at runtime, the object you happen to pop off the stack isn't a MyClass, casting won't magically turn it into one. You'll get a ClassCastException.

  • Portal Entitlements for user defined objects

    Hi,
    The UUP aggregates the user profile information from different backed data sources.
    One of the properties in the propertyset is a multivalued property. I populate
    this by the following code:
    PropertyMapKey propertyMapKeyM = new PropertyMapKeyImpl(null,"DA_Privilege");
    String str="LAB1_CAPLinks_ViewReports" + "," + "LAB1_CAPLinks_EditReports"; //hardcoded
    for testing
    propertyCache.put(propertyMapKeyM,str);
    (This code resides in the MyEntityPropertyManager)
    When I go to the portal administration screen, I do not see the values, it instead
    only gives me the object id of the java String array.
    Could someone please help me with the following questions:
    1. How do I populate the multivalued property ? I see in documentation that there
    is 2 different PropertyCache implementation......confused which one to use and
    how.
    2. Is there a way to define user defined objects in UUP and have portlets entitled
    to the state of the object ? (a custom entitlement code)
    3. Any sample code would be helpfull
    Thanks,
    Uday

    Thank You Greg. Now it works.
    -Uday
    Gregory Smith <[email protected]> wrote:
    I'm not totally sure, but I would imagine you want to put a List of
    Strings into the propertyCache if the property is supposed to be
    multivalued text, e.g.:
    PropertyMapKey propertyMapKeyM = new PropertyMapKeyImpl(null,
         "DA_Privilege");
    List strs = new ArrayList(2);
    strs.add("LAB1_CAPLinks_ViewReports");
    strs.add("LAB1_CAPLinks_EditReports");
    propertyCache.put(propertyMapKeyM, strs);
    I know that all of the code that calls the UUP and property sets code
    expects a Collection back from a multivalued property (but I'm not sure
    about a UUP implementation).
    Greg
    Udayraj Nair wrote:
    Hi,
    The UUP aggregates the user profile information from different backeddata sources.
    One of the properties in the propertyset is a multivalued property.I populate
    this by the following code:
    PropertyMapKey propertyMapKeyM = new PropertyMapKeyImpl(null,"DA_Privilege");
    String str="LAB1_CAPLinks_ViewReports" + "," + "LAB1_CAPLinks_EditReports";//hardcoded
    for testing
    propertyCache.put(propertyMapKeyM,str);
    (This code resides in the MyEntityPropertyManager)
    When I go to the portal administration screen, I do not see the values,it instead
    only gives me the object id of the java String array.
    Could someone please help me with the following questions:
    1. How do I populate the multivalued property ? I see in documentationthat there
    is 2 different PropertyCache implementation......confused which oneto use and
    how.
    2. Is there a way to define user defined objects in UUP and have portletsentitled
    to the state of the object ? (a custom entitlement code)
    3. Any sample code would be helpfull
    Thanks,
    Uday

  • What is user-defined object?

    hi,
    can someone pls explain to me what does user-defined object means???
    my final yr proj is abt that and i really have no idea abt what is user-defined object...
    thank u...
    (duke point awarded of coz)

    my final yr proj is abt that and i really have no
    e no idea abt what is user-defined object...
    thank u...Well u'd better get started here (http://java.sun.com/docs/books/tutorial/getStarted/index.html) then, dont u ?
    ram.

  • Crystal Report Templates for User-Defined Objects

    Hello Experts,
    I am running SAP B1 8.8 PL11. In the current patch SAP has default Crystal Reports that can be used as Layouts for Invoices, Credit Memo's so on. Is it possbile to have layouts for user defined objects ( say for instance i have a customized form under sales module, can i import a crystal template for this customized form?). In the report layout manager i don't see an option to import user-defind objects.
    Any help would be appreciated.
    Thanks,
    Praneeth

    If this is still a problem please re-post to the SAP Integration Kit forum.

  • User defined function in java for message mapping

    I wrote the following user defined function in java for message mapping and mapped vendor with this. The aim of this function is to write a error file at defined path when i send empty Vendor value from File to RFC-Function module BAPI_PO_CREATE. The "err.txt" error file is not written when i execute in TEST but the value "ERROR" is returned to destination Vendor Field.
    public String  validation(String a, Container container) {
    //write your code here
    if (a.equals("")) {
    try {
    String source = "Vendor cannot be empty";
    char buffer[] = new char[source.length()];
    source.getChars(0, source.length(), buffer, 0);
    for (int i = 0; i < buffer.length; i +=2)
       f0.write(buffer<i>);
    f0.close();
    FileWriter f1 =  new FileWriter("/10.10.0.55/sapmnt/trans/edixiin/err.txt");
    f1.write(buffer);
    f1.close();
    catch (IOException e) {}
    return "ERROR";

    Hi Senthil,
    Check these things :
    1) Whether you have permission to create a file in that directory.
    2) try giving this 
    10.10.0.55
    sapmnt
    trans
    edixiin
    err.txt
    3) Also check for permissions.
    Hope this will help you.
    Regards
    Suraj

  • Manual document number in User-Defined Object

    Hi Experts,
    I have a user-defined object of document type.  I am trying to post a document using the General Service. However, I cannot assign manual document number.  There is no handwritten property available.  Is it possible to assign manual document number in user-defined objects using the DI API?
    Thanks.
    Melvin

    Hi,
    This issue has been resolved.  For the benefit of those who will be encountering this error, it was resolved by manually assigning the Handwrtten field to 'Y'.  Here is the code fragment:
    shipmentHeader.SetProperty("Handwrtten", 'Y')';

  • DTW user-defined object issues

    Dear all,
    I've tried to import a user-defined object with a template through DTW.
    However, I got an error message "To generate this document, first define the numbering series in the Administration moduleApplication-defined or object-defined error.
    Any ideas?
    Pls help.
    Thanks

    Hi,
    It is a limitation of the UDO that it is not possible to enter new values via DI or DTW. 
    There is a way to automatically fill your object's user tables. Please see the Note [804685|https://websmp130.sap-ag.de/sap(bD1odSZjPTAwMQ==)/bc/bsp/spn/sapnotes/index2.htm?numm=804685] for more details regarding the issue description and the workaround available.                               
    hope it helps,
    Regards,
    Ladislav
    SAP Business One Forum Team

  • UDO--user defined object

    how to use UDO--user defined object in sap b1????

    Creating UDO in SAP B1
    1. Create UDT, ( Create UDT as Document if want the code to be in auto increament form)
    2. Create UDFs for created UDT,
    3. Register Object using  "Object Registration Wizard",
                    (a) Put UDT's unique name in "UNIQUE ID" field of UDO (Image - UDO01.jpg) ,
                    (b) Do further as per requirements,
    4. After Registering the UDO, you can access it from where you have set it to access (@ UI Settings of "User - Defined Object Registration Wizard"),
    5. If you wana change the field location / change the design of the form, Open screen painter as and click on "Open User Defined Object List " (Mostly 3rd icon from Left in screen painter),
    6. Make required changes and save it by clicking "Save Form To Database" ( Mostly 2nd icon from Left in Screen Painter),
    7. Now the UDO is ready and can be used by user.

  • Transfer user defined object between 2 databaeses

    i have created a user defined object in my local db.
    i need to import it to the companies server.
    what should i do ?

    If you are talking about the definition - you can use the Copy Express Add-On from SAP.
    Regards

  • Problen in ChooseFromList & User Defined Object

    Hello.
    I'm trying to use a [ChooseFromList] that calls info from one User Table called @LABS this table is MasterData type.
    I add a User Defined Object in runtime, called UO_Labs
    Then, I add one ChooseFromList to my form (This form was made in ScreenPainter)
    The user object was created fine, the ChooseFromList is added fine, the form loads fine, but, when I press tab or the button of the ChooseFromList I get this error: "Internal error (-1003) ocurred [Message 131-183]"
    I try to use my ChooseFromList in one Matrix and in one EditText objects. And gives me the same error in both objects.
    I'm using SAP 2007 PL 35
    This is my code:
    Adding the User Defined Object -
    Dim UO As SAPbobsCOM.UserObjectsMD
    UO = CompanyObj.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oUserObjectsMD)
    UO.ManageSeries = SAPbobsCOM.BoYesNoEnum.tNO
    UO.CanCancel = SAPbobsCOM.BoYesNoEnum.tYES
    UO.CanClose = SAPbobsCOM.BoYesNoEnum.tYES
    UO.CanDelete = SAPbobsCOM.BoYesNoEnum.tYES
    UO.CanFind = SAPbobsCOM.BoYesNoEnum.tYES
    UO.CanLog = SAPbobsCOM.BoYesNoEnum.tNO
    UO.CanYearTransfer = SAPbobsCOM.BoYesNoEnum.tNO
    UO.CanCreateDefaultForm = SAPbobsCOM.BoYesNoEnum.tYES
    UO.Code = "UO_Labs"
    UO.Name = "Laboratory Info."
    UO.ObjectType = SAPbobsCOM.BoUDOObjType.boud_MasterData
    UO.TableName = "LABS"
    If UO.FormColumns.Count = 0 Then UO.FormColumns.Add()
    UO.FormColumns.SonNumber = 0
    UO.FormColumns.FormColumnAlias = "Code"
    UO.FormColumns.FormColumnDescription = "Code"
    UO.FormColumns.Add()
    UO.FormColumns.SonNumber = 0
    UO.FormColumns.FormColumnAlias = "Name"
    UO.FormColumns.FormColumnDescription = "Name"
    If UO.Add() <> 0 Then
          Application.MessageBox(CompanyObj.GetLastErrorDescription)
    End If
    END Adding the User Defined Object -
    This code adds my UDO and it works fine, has data and do the work.
    Adding the [ChooseFromList] Object -
    '// form object is send in parameters.
    Dim oCFLs As SAPbouiCOM.ChooseFromListCollection = f.ChooseFromLists
    Dim oCFL As SAPbouiCOM.ChooseFromList
    Dim oCFL_CP As SAPbouiCOM.ChooseFromListCreationParams
    Dim matrix As SAPbouiCOM.Matrix = form.Items.Item("matrix").Specific
    oCFL_CP = App.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_ChooseFromListCreationParams)
    oCFL_CP.MultiSelection = False
    oCFL_CP.ObjectType = "UO_Labs"
    oCFL_CP.UniqueID = "cfl_Labs"
    oCFL = oCFLs.Add(oCFL_CP)
    matrix.Columns.Item("labCode").ChooseFromListUID = "cfl_Labs"
    matris.Columns.Item("labCode").ChooseFromListAlias = "Code"
    form.Refresh()
    END Adding the [ChooseFromList] Object -
    Thanks for your time...
    Greetings
    Gabriel Vasquez.

    Hi Gabriel,
    Please check in B1 if the UDO is created correctly, specifically the CanFind option. I got that error once, with one of my addons, that somehow was created with CanFind=tNo, despite my code indication CanFind=tYes...
    Also, try adding the CFL directly in the XML form.
       <column uid="C_labCod" type="116" title="Lab. Code" description="Laboratory Code" visible="1" AffectsFormMode="1" width="70" disp_desc="1" editable="1" right_just="0" val_on="Y" val_off="N" backcolor="-1" forecolor="-1" text_style="0" font_size="-1" ChooseFromListUID="cfl_Labs" ChooseFromListAlias="Code">
          <databind databound="1" table="@LABS" alias="U_labCode"></databind>
          <ExtendedObject linkedObject="" LinkedObjectType=""></ExtendedObject>
       </column>
       <ChooseFromListCollection>
          <action type="add">
             <ChooseFromList UniqueID="-1" ObjectType="-1" MultiSelection="0" IsSystem="1"></ChooseFromList>
             <ChooseFromList UniqueID="cfl_Labs" ObjectType="UO_Labs" MultiSelection="0" IsSystem="0"></ChooseFromList>
          </action>
       </ChooseFromListCollection>
    Also, it's a good practice to your SAP partner's NameSpace as prefix to UDOs, UDTs, UDFs and UDKeys, in order to avoid conflicts with other partner's add-ons.
    Regards,
    Vítor Vieira

  • How to assign a query retrived value to a user defined  object in a table

    how to assign a query retrived value to a user defined  object in a table

    Rajeshwar,
    If you use the "Search" feature in this forum, you should be able to find helpful links to similar questions.  You could also look at the RecordSet and DoQuery documentation in the SAP Business One SDK Help Center documentation to assist you with your question.
    HTH,
    Eddy

  • Wanting to copy DOM element child value into user defined object in PL/SQL.

    We have a DOM object and can retrieve the object elements. We are wanting to take the elements and map them to user defined object attributes. We want to then place the element child (the text portion of <item>Foo</item> into the object attribute. Is there a package or utility that is available where we can simply pass the DOM and user defined objects and "magic happens here"?

    We have a DOM object and can retrieve the object elements. We are wanting to take the elements and map them to user defined object attributes. We want to then place the element child (the text portion of <item>Foo</item> into the object attribute. Is there a package or utility that is available where we can simply pass the DOM and user defined objects and "magic happens here"?

Maybe you are looking for

  • All pages/tabs from previous browsing sessions open.

    Well this is a truly annoying "feature" in Lion. I just upgraded from Snow Leopard. Every time I open Safari, windows open from a previous session. I've searched Safari's preferences and can't find anything to disable this. Even emptied cache. No luc

  • Issues opening document from a webgate protected site.

    I have an web application protected by webgate using basic authentication. There is a link to a word document in the web page. When a user click that link, the user gets the basic authentication pop-up again. Even if the user clicks cancel, the word

  • I WANT TO OPEN A PORTAL PAGE INTO A PORTAL REGION

    I have two pages published as portlets(P1,P2). P1 have a portal link to P2 and it works perfectly. My problem occurs when: 1) I create a new group of pages. 2) In this group, i create a new Portal page(P3). 3) In a region of P3 I load p1 as a portlet

  • Row-level security tied to a user account.

    Bear with me, I'm not quite sure I know what I'm talking about. Recently we migrated from BO 5.1.7 to BO XII r2 on Solaris. Under Bo 5.1.7 our Finance users tell me there was a way to attach row level security to the account itself. For example, Fina

  • T.Codes for SAP XI 3.0

    Hi All, Can one give me all the SAP XI related transaction codes so that it will easy for me to learn SAP XI or any URL which will give me the same. Regards, Krushna Biswal