Results 1 to 5 of 5
  1. #1
    itaipee is offline Member
    Join Date
    Dec 2008
    Posts
    99
    Rep Power
    0

    Default avoiding memory over-consuming

    Hi

    An application that I made take a lot of memory. a lot.

    The application include GUI and managment of small database - and yet, if open for several days without reset - I see it consumes 700 MB

    I start read about

    My main Class , called Seal.
    Many object and many method , static and regular , have the main class as argument

    i.e.
    public ActionListenerToSeal2(Seal seal1, String key1,JCheckBox b1){ .. }
    public static boolean verifyStatusChange(Seal seal, String key) {... }
    private void updateSpcVarFromGloabl(Seal seal) { .... }

    I I understand right - having 'Seal seal ' as an argument prevent this object to be deleted ?

  2. #2
    Addez is offline Senior Member
    Join Date
    Aug 2009
    Posts
    294
    Rep Power
    0

    Default

    I dont know but I would guess so, Why else would it be named seal?

  3. #3
    itaipee is offline Member
    Join Date
    Dec 2008
    Posts
    99
    Rep Power
    0

    Default

    Seal is just the name of the main object - which control both GUI and database. its object that open only once and exist as long as the program is working

    the question is - if temporery objects that link the this primary class - will remain in the memory ? is that the root cause of my memory problem ?

    If do - what can I do instead of linking to the main object

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

    Default

    No, having "Seal seal" as an argument does not prevent anything from being garbage collected. Analyse your code. Are you maybe adding things to maps or lists and then not deleting them when no longer needed?

  5. #5
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,014
    Rep Power
    20

    Default

    Yep.
    Grab a heap dump and analyse that. There's lots of tools around for it (Eclipse has a pretty decent one I've used before). They'll point you at the most likely culprit. Which'll probably be a Collection of some sort.

Similar Threads

  1. Avoiding system.exit()
    By swati.jyoti in forum New To Java
    Replies: 5
    Last Post: 07-01-2009, 10:17 AM
  2. Replies: 2
    Last Post: 08-21-2008, 07:33 PM
  3. Avoiding refresh
    By java_srinivasan in forum JavaServer Pages (JSP) and JSTL
    Replies: 0
    Last Post: 06-25-2008, 09:01 AM
  4. avoiding if statements
    By valoyivd in forum New To Java
    Replies: 1
    Last Post: 04-02-2008, 09:08 AM
  5. How to reduce the size or avoiding out of memory error?
    By rajeshkumarmsc in forum Advanced Java
    Replies: 3
    Last Post: 08-11-2007, 10:15 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
  •