Results 1 to 5 of 5

Thread: Object Reuse

  1. #1
    sankarguru is offline Member
    Join Date
    Mar 2009
    Location
    India
    Posts
    16
    Rep Power
    0

    Exclamation Object Reuse

    Hi all
    i am getting lots of memeory leakage problem, after doing some internal test, it's becoz of lots of object creation on every request..
    How to utilize the old object instead of creating new objects every time..

    Thanks in Advance...

    sankarguru

  2. #2
    toadaly is offline Senior Member
    Join Date
    Jan 2009
    Posts
    671
    Rep Power
    6

    Default

    Knowing the context would help. Please post some code and point out where the problems are that you know of.

  3. #3
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

    Default

    So a lot of objects are being created. So what. As I have told you before, as long as you are not hanging on to these references outside of their intended scope, this is not a problem.

    How much do you currently have your max heap size set to? For truely large applications 1024m should be enough. If you have less than that, then increase it to that.

    Now, as soon as the request is finished, these objects you're speaking of should be garbage collected, and so should not be a problem. If you see that requests are finishing and the objects remain, then check your code. You are not getting rid of the references. It is that simple.

  4. #4
    logicbug's Avatar
    logicbug is offline Member
    Join Date
    Jan 2009
    Location
    The Great White North, eh?
    Posts
    76
    Rep Power
    0

    Default

    create a constructor for your object in your class and reuse it through out your classess methods.

  5. #5
    sankarguru is offline Member
    Join Date
    Mar 2009
    Location
    India
    Posts
    16
    Rep Power
    0

    Default

    Thanks for your comments...
    i try to implement those points.

    Sankarguru

Similar Threads

  1. Struts: Reuse data across multiple ActionForms problem
    By Tequila_Burp in forum Web Frameworks
    Replies: 3
    Last Post: 12-12-2012, 10:04 AM
  2. Replies: 2
    Last Post: 11-26-2010, 02:12 AM
  3. Replies: 1
    Last Post: 03-04-2009, 06:14 PM
  4. Replies: 1
    Last Post: 07-22-2008, 04:27 PM
  5. Replies: 1
    Last Post: 04-17-2008, 10:10 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •