SageTV Community  

Go Back   SageTV Community > SageTV Development and Customizations > SageTV Studio
Forum Rules FAQs Community Downloads Today's Posts Search

Notices

SageTV Studio Discussion related to the SageTV Studio application produced by SageTV. Questions, issues, problems, suggestions, etc. relating to the Studio software application should be posted here.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 10-19-2010, 11:18 AM
tmiranda's Avatar
tmiranda tmiranda is offline
SageTVaholic
 
Join Date: Jul 2005
Location: Central Florida, USA
Posts: 5,851
Debugging the Java Heap

One of my plugins is eating all of the Java Heap and I'm having difficulty tracking down the bug. Is there a way to see what Objects are in the Java Heap?
__________________

Sage Server: 8th gen Intel based system w/32GB RAM running Ubuntu Linux, HDHomeRun Prime with cable card for recording. Runs headless. Accessed via RD when necessary. Four HD-300 Extenders.
Reply With Quote
  #2  
Old 10-19-2010, 12:48 PM
stuckless's Avatar
stuckless stuckless is offline
SageTVaholic
 
Join Date: Oct 2007
Location: London, Ontario, Canada
Posts: 9,713
What you are looking for is a Java Profiler. I've never run one with sagetv before, but you may be able to start here...

http://java.sun.com/developer/techni...ing/HPROF.html

And then see, if perhaps, your IDE has any profiling tools. I used to use JRat a long time ago as well... but I haven't actually used any recent ones (I think eclipse that TPTP?? Testing and Performance something). Netbeans has something as well.

Typically, if you are running out heap space... you might have an endless loop condition. I use the FindBugs plugin a lot to help me "clean" up my code. It finds all sorts of little programming gotchas... it's pretty easy to use, and you can run it from eclipse, against a project (which is what I do)... you might want to run it first, to see what it finds. i recommend running it anyways.
Reply With Quote
  #3  
Old 10-19-2010, 02:39 PM
broconne broconne is offline
Sage Aficionado
 
Join Date: Feb 2009
Location: Cary, NC
Posts: 306
I second Stuckless's recommendation of using FindBugs - it is a great static analysis tool.

I can recommend JProbe as well, JDB is a great start - but since you are not invoking the JVM - I am not sure how you are going to attach any tool to the running VM. There are tools for analyzing heapdumps - If you are on windows, I am not sure how you can force sage to create a heapdump either. On linux, you might be able to send a kill command and create a heapdump - depending on the JVM.

You can attach with JConsole - but I don't think that will give you any details about memory usage.

Do you have any idea what might be causing it? Could share that part of the code and I am sure others could look for some unintended object retention.
Reply With Quote
  #4  
Old 10-19-2010, 05:42 PM
tmiranda's Avatar
tmiranda tmiranda is offline
SageTVaholic
 
Join Date: Jul 2005
Location: Central Florida, USA
Posts: 5,851
Sean, broconne,

Thanks for the suggestions. I'm using Netbeans as an IDE so I'll see what tools I can find there.

I have no idea what code is causing the out of memory error, but I think it's an endless loop somewhere because there is a slight delay before things blow up.

It might also be caused by my caching of data in memory. I remove all references to the data when I'm done so the GC can reclaim the memory but maybe it's taking a long time to cleanup?

Tom
__________________

Sage Server: 8th gen Intel based system w/32GB RAM running Ubuntu Linux, HDHomeRun Prime with cable card for recording. Runs headless. Accessed via RD when necessary. Four HD-300 Extenders.
Reply With Quote
  #5  
Old 10-19-2010, 05:55 PM
jphipps jphipps is offline
Sage Expert
 
Join Date: Aug 2006
Location: Maryland
Posts: 512
Quote:
Originally Posted by tmiranda View Post
Sean, broconne,

Thanks for the suggestions. I'm using Netbeans as an IDE so I'll see what tools I can find there.

I have no idea what code is causing the out of memory error, but I think it's an endless loop somewhere because there is a slight delay before things blow up.

It might also be caused by my caching of data in memory. I remove all references to the data when I'm done so the GC can reclaim the memory but maybe it's taking a long time to cleanup?

Tom
You can use jvisualvm, which is part of the normal 1.6 java distribution. You just have to run the sage server as a foreground process and not as a service. Once you start sage and then start jvisualvm, you will see sage running and can connect to it using JMX and you can see the live object/memory utilization and do thread/memory dumps to see where memory is being used...

Thanks,
Jeff
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Java Heap Size rickgillyon SageTV Beta Test Software 48 12-14-2011 04:47 AM
Java Heap Size craigap SageTV Media Extender 21 03-27-2010 10:53 AM
HD-PVR and java heap dead_ferrets Hardware Support 11 12-10-2009 09:54 AM
Java Heap help gibsonpa SageTV Software 3 08-06-2008 03:11 PM
Java Heap in vista hellsingfan SageTV Software 3 06-29-2008 06:57 PM


All times are GMT -6. The time now is 07:58 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2023, vBulletin Solutions Inc.
Copyright 2003-2005 SageTV, LLC. All rights reserved.