Results 1 to 3 of 3
  1. #1
    pvh35 is offline Member
    Join Date
    Jan 2011
    Posts
    2
    Rep Power
    0

    Default how to record maximum heap memory consumption

    Hi,
    I'd like to know what is the maximum heap memory reached during a java program execution.
    I'm not searching for a graphic tools because I want to be able to record the value in a file each time I run the program.
    Does anybody could help me ?
    Thanks.

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,728
    Blog Entries
    7
    Rep Power
    21

    Default

    Quote Originally Posted by pvh35 View Post
    Hi,
    I'd like to know what is the maximum heap memory reached during a java program execution.
    I'm not searching for a graphic tools because I want to be able to record the value in a file each time I run the program.
    Have a look at the Runtime object, it can give you some statistics about memory usage.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  3. #3
    pvh35 is offline Member
    Join Date
    Jan 2011
    Posts
    2
    Rep Power
    0

    Default

    Thanks for your suggestion Jos.

    Well, as for ManagementFactory.getMemoryPoolMXBeans(), the value returned is a snapshot value. After a garbage collector execution, the heap can decrease. so it will not give you the maximum used.

    Pascal.

Similar Threads

  1. How to maximum release memory in StAX?
    By kingsz1 in forum XML
    Replies: 0
    Last Post: 07-18-2010, 01:50 AM
  2. get maximum heap size that can be allocated
    By gautam.aditya97 in forum Java 2D
    Replies: 3
    Last Post: 04-05-2010, 06:03 AM
  3. Heap memory
    By gayathri_g in forum New To Java
    Replies: 12
    Last Post: 09-10-2009, 09:45 AM
  4. Replies: 2
    Last Post: 08-21-2008, 08:33 PM
  5. Consumption of memory
    By Daniel in forum Advanced Java
    Replies: 1
    Last Post: 07-06-2007, 10:11 PM

Tags for this Thread

Posting Permissions

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