Re: Memory utilization
Peter Booth <[email protected]> Wed, 30 Jan 2008 08:43:12 -0500
| Newsgroups | gmane.comp.windows.devel.java.advanced |
|---|---|
| Message-ID | <[email protected]> |
Sounds like the NetBeans profiler is broken or user error.
I think that the best profiler available today is the Your Kit
profiler. It is simply first rate.
On Jan 29, 2008, at 8:45 PM, Avinash Lakshman wrote:
> I was trying to profile the following piece of code using NetBeans:
>
> public static void main(String[] args)
> {
> Map<String, String> map = new HashMap<String, String>();
> for( int i = 0; i < Integer.MAX_VALUE; ++i )
> {
> map.put(Integer.valueOf(i).toString(),
> Integer.valueOf(i).toString());
> }
> }
>
>
> I set my max and min heap size to be 1GB. I find that the program
> dies after having created 4M entries (at which point the heap used
> is at 1GB) although the memory used by the objects as indicated by
> the Netbeans memory profiler is the following:
>
> String -- 48MB
> char[] -- 48 MB
> HeapCharBuffer -- 45MB
> Integer -- 19MB
> HashMap$Entry -- 19MB
>
>
> This totals to less than 200 MB and the rest of the objects are at
> 0% of the total used memory. How come the heap usage is at 1GB at
> this point of time? I am extremely confused. Could someone please
> explain what might be going on?
>
> Thanks
> A
>
> _________________________________________________________________
> Need to know the score, the latest news, or you need your HotmailĀ®-
> get your "fix".
> http://www.msnmobilefix.com/Default.aspx
> ===================================
> This list is hosted by DevelopMentorĀ® http://www.develop.com
>
> View archives and manage your subscription(s) at http://discuss.develop.com
===================================
This list is hosted by DevelopMentorĀ® http://www.develop.com
View archives and manage your subscription(s) at http://discuss.develop.com