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

    Question Memory leakage problem

    Hi all,
    How to avoid memory leakage problrm in Java,
    according to our design , we are creating lots of objects for every request, so we are getting memory out exception..

    Give me some solutions

    Thanks in advance

    Sankarguru.T

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

    Default

    By making sure you don't hang to references to the instances outside of the necessary scope. Nothing else.

  3. #3
    arseny is offline Member
    Join Date
    Mar 2009
    Posts
    25
    Rep Power
    0

    Default

    Another solution - you can give more memory to the JVM instance.
    the cmd line will look like: java -Xmx1300m -cp ....

  4. #4
    dlorde is offline Senior Member
    Join Date
    Jun 2008
    Posts
    339
    Rep Power
    8

    Default

    As masijade said, make sure any references are removed when the objects go out of scope or are not required any more - particularly references in static lists and references held in long-lived objects, e.g. as listeners/observers.

    You could try using the Flyweight Design Pattern to minimize memory use by sharing as much as possible between objects.

Similar Threads

  1. Replies: 2
    Last Post: 08-21-2008, 07:33 PM
  2. Data Leakage in Struts 2
    By arun3m in forum Web Frameworks
    Replies: 0
    Last Post: 07-26-2008, 07:54 PM
  3. Out of memory
    By mew in forum New To Java
    Replies: 1
    Last Post: 01-20-2008, 09:55 AM
  4. Memory leakage problem
    By Amali_Prem in forum New To Java
    Replies: 0
    Last Post: 01-17-2008, 11:45 AM
  5. Memory
    By mew in forum CLDC and MIDP
    Replies: 0
    Last Post: 12-28-2007, 12:02 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
  •