SageTV Community  

Go Back   SageTV Community > SageTV Products > SageTV Software
Forum Rules FAQs Community Downloads Today's Posts Search

Notices

SageTV Software Discussion related to the SageTV application produced by SageTV. Questions, issues, problems, suggestions, etc. relating to the SageTV software application should be posted here. (Check the descriptions of the other forums; all hardware related questions go in the Hardware Support forum, etc. And, post in the customizations forum instead if any customizations are active.)

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 11-08-2009, 12:45 PM
craigap craigap is offline
Sage Aficionado
 
Join Date: Jan 2006
Location: Monroe, WI
Posts: 348
Maxing out Java Heap at 799mb

Java heap is at 539/799/799 right now. I run vista business 32bit and have 2gb of RAM. it would appear I need to bump up my Java heap, but doing so would seem to leave me with only about half my RAM for OS stuff. Not sure if that how it works or not, but if so then should I look into adding another Gig of ram to my HTPC?
__________________
Windows 10
Sagetv 9 64bit (9.2.5)
HVR-2255 x3 OTA
Reply With Quote
  #2  
Old 11-08-2009, 03:00 PM
Fuzzy's Avatar
Fuzzy Fuzzy is offline
SageTVaholic
 
Join Date: Sep 2005
Location: Jurupa Valley, CA
Posts: 9,957
If you are running STVi's that are that extensive graphically, then yes, your option for better performance would be to get more ram on there. You can still bump up the heap larger, and windows will just have to swap stuff a bit more, so you'll get hurt on overall system performance, but might get a bit smoother fanart and such... just try it out and see...

That said.. RAM is actually pretty cheap...
__________________
Buy Fuzzy a beer! (Fuzzy likes beer)

unRAID Server: i7-6700, 32GB RAM, Dual 128GB SSD cache and 13TB pool, with SageTVv9, openDCT, Logitech Media Server and Plex Media Server each in Dockers.
Sources: HRHR Prime with Charter CableCard. HDHR-US for OTA.
Primary Client: HD-300 through XBoxOne in Living Room, Samsung HLT-6189S
Other Clients: Mi Box in Master Bedroom, HD-200 in kids room
Reply With Quote
  #3  
Old 11-08-2009, 03:41 PM
stanger89's Avatar
stanger89 stanger89 is offline
SageTVaholic
 
Join Date: May 2003
Location: Marion, IA
Posts: 15,188
Here's a question, anybody figured a way around Java's sometime "weird" limiting of Heap Size?
Reply With Quote
  #4  
Old 11-08-2009, 06:44 PM
Fuzzy's Avatar
Fuzzy Fuzzy is offline
SageTVaholic
 
Join Date: Sep 2005
Location: Jurupa Valley, CA
Posts: 9,957
there is nothing weird about java memory management... it's just poor to begin with.. never expect 'good' behavior from any JVM, memory wise... if only sage was .net.. hehe
__________________
Buy Fuzzy a beer! (Fuzzy likes beer)

unRAID Server: i7-6700, 32GB RAM, Dual 128GB SSD cache and 13TB pool, with SageTVv9, openDCT, Logitech Media Server and Plex Media Server each in Dockers.
Sources: HRHR Prime with Charter CableCard. HDHR-US for OTA.
Primary Client: HD-300 through XBoxOne in Living Room, Samsung HLT-6189S
Other Clients: Mi Box in Master Bedroom, HD-200 in kids room
Reply With Quote
  #5  
Old 11-08-2009, 07:32 PM
stuckless's Avatar
stuckless stuckless is offline
SageTVaholic
 
Join Date: Oct 2007
Location: London, Ontario, Canada
Posts: 9,713
Quote:
Originally Posted by stanger89 View Post
Here's a question, anybody figured a way around Java's sometime "weird" limiting of Heap Size?
I guess my question is what is "weird" about the heap size?

Quote:
Originally Posted by Fuzzy View Post
there is nothing weird about java memory management... it's just poor to begin with.. never expect 'good' behavior from any JVM, memory wise... if only sage was .net.. hehe
You must be a very hard core java developer/engineer (engineer, if I had to guess) that has done extensive research on the jvm memory sub system. Perhaps you can explain why I should never expect to see 'good' behaviour from the jvm. I'm always trying to better understand the inner workings of java.
Reply With Quote
  #6  
Old 11-08-2009, 07:56 PM
stanger89's Avatar
stanger89 stanger89 is offline
SageTVaholic
 
Join Date: May 2003
Location: Marion, IA
Posts: 15,188
Quote:
Originally Posted by stuckless View Post
I guess my question is what is "weird" about the heap size?
Mainly that it's very unpredictable what the actual maximum is. It seems to vary from PC to PC from one moment to the next.
Reply With Quote
  #7  
Old 11-08-2009, 08:12 PM
stuckless's Avatar
stuckless stuckless is offline
SageTVaholic
 
Join Date: Oct 2007
Location: London, Ontario, Canada
Posts: 9,713
Quote:
Originally Posted by stanger89 View Post
Mainly that it's very unpredictable what the actual maximum is. It seems to vary from PC to PC from one moment to the next.
I see. I'm not sure the "real" default heap size is actually documented anywhere, so yeah, if an application doesn't specify it's memory requirements then i'm not sure what it would be...and it probably would differ from java version (not necessarily machine to machine). But, if we are talking about sage, then I can say that on linux, they set the default memory size to be 256mb (which I usually increase to 1 gig).
Reply With Quote
  #8  
Old 11-08-2009, 08:30 PM
stanger89's Avatar
stanger89 stanger89 is offline
SageTVaholic
 
Join Date: May 2003
Location: Marion, IA
Posts: 15,188
Supposedly it's 1906MB or something, but I've never been able to actually start a VM with that. I was playing a little while ago with BMT and "accidentally" set that test install to import way too much stuff and ran out of heap, so I remember trying to just set Sage to the max I could and I think at that time I couldn't manage over 1100MB, today I tried, same machine and could do 1600MB....
Reply With Quote
  #9  
Old 11-08-2009, 09:22 PM
Fuzzy's Avatar
Fuzzy Fuzzy is offline
SageTVaholic
 
Join Date: Sep 2005
Location: Jurupa Valley, CA
Posts: 9,957
Two main complaints I have with JVM is that:
1. The arbitrary fixed max size has to be declared at runtime.
2. The JVM will never release memory back to the operating system.

Admittedly, this is probably based on the original incarnations of Java being designed primarily for smaller applets, that usually have fixed memory footprints, it doesn't scale well to large dynamic apps like sage.
__________________
Buy Fuzzy a beer! (Fuzzy likes beer)

unRAID Server: i7-6700, 32GB RAM, Dual 128GB SSD cache and 13TB pool, with SageTVv9, openDCT, Logitech Media Server and Plex Media Server each in Dockers.
Sources: HRHR Prime with Charter CableCard. HDHR-US for OTA.
Primary Client: HD-300 through XBoxOne in Living Room, Samsung HLT-6189S
Other Clients: Mi Box in Master Bedroom, HD-200 in kids room
Reply With Quote
  #10  
Old 11-08-2009, 09:22 PM
stuckless's Avatar
stuckless stuckless is offline
SageTVaholic
 
Join Date: Oct 2007
Location: London, Ontario, Canada
Posts: 9,713
Quote:
Originally Posted by stanger89 View Post
Supposedly it's 1906MB or something, but I've never been able to actually start a VM with that. I was playing a little while ago with BMT and "accidentally" set that test install to import way too much stuff and ran out of heap, so I remember trying to just set Sage to the max I could and I think at that time I couldn't manage over 1100MB, today I tried, same machine and could do 1600MB....
Ok... now i really see

I guess i've never hit the upper limit, but, just to test this on my machine, I could create a machine at 2600mb... but not at 2700... and I think you are right, that the limit will vary from machine to machine depending on resources, etc. I think that java fails if it cannot allocate a contiguous block of memory.

I'm guessing the bmt issue was related to the dvd profiler xml... that's a very large file, and bmt uses a DOM parser (not smart) and so it has to cram it all into memory.

A think to note about java memory, is that if you allocate memory to the jvm, then the jvm will hold onto that memory and not let other system resources use the memory. Within the JVM it will continue to allocate objects into that space and it won't really try to free those objects until it has to. Depending on your jvm version, java may just let them accumulate until it determines it can't actually create another object, and if so it will run the garbage collector, and then try to allocate the object again. If it can't free enough contiguous heap space to create the object, then it will fail with an Out Of Memory error. Keep in the mind the actual process is alot more complex than my simple explanation, but the bottom line is really... unless you are seeing out of memory errors, or you are experiences freezes in the application related to the garbage collector running, then something like 539/799/799 is probably ok.

This differs from .net (at least my understanding of it) in that in .net, an application can access the complete memory on the system. But like java, it also uses a garbage collector to reclaim objects. Both Java and .net use very similar models for garbage collection, (including when to run and how to run), but I personally like the "constrained" memory model of java, since I can control how much memory i'm willing to allow the application to abuse.
Reply With Quote
  #11  
Old 11-08-2009, 09:33 PM
stuckless's Avatar
stuckless stuckless is offline
SageTVaholic
 
Join Date: Oct 2007
Location: London, Ontario, Canada
Posts: 9,713
Quote:
Originally Posted by Fuzzy View Post
Two main complaints I have with JVM is that:
1. The arbitrary fixed max size has to be declared at runtime.
2. The JVM will never release memory back to the operating system.

Admittedly, this is probably based on the original incarnations of Java being designed primarily for smaller applets, that usually have fixed memory footprints, it doesn't scale well to large dynamic apps like sage.
See... isn't that a lot more constructive than your original... "Java sucks... I wish sage were .net" (i paraphrased)

BTW... i agree with your complaints (now that I know what they are)... but I'd still rather have the fixed memory constraints of Java than an open upper limit. Imagine how unresponsive your machine would get if Sage could allocate the entire system resources... including swap... because of some memory leak a plugin that some developer wrote as an add on
Reply With Quote
  #12  
Old 11-08-2009, 09:36 PM
Fuzzy's Avatar
Fuzzy Fuzzy is offline
SageTVaholic
 
Join Date: Sep 2005
Location: Jurupa Valley, CA
Posts: 9,957
You can specify memory limits programatically in .NET, and even localized to certain 'jobs'. More importantly, this can be done dynamically while the program is running, instead of having to be determined prior to any code execution.
__________________
Buy Fuzzy a beer! (Fuzzy likes beer)

unRAID Server: i7-6700, 32GB RAM, Dual 128GB SSD cache and 13TB pool, with SageTVv9, openDCT, Logitech Media Server and Plex Media Server each in Dockers.
Sources: HRHR Prime with Charter CableCard. HDHR-US for OTA.
Primary Client: HD-300 through XBoxOne in Living Room, Samsung HLT-6189S
Other Clients: Mi Box in Master Bedroom, HD-200 in kids room
Reply With Quote
  #13  
Old 11-08-2009, 09:48 PM
craigap craigap is offline
Sage Aficionado
 
Join Date: Jan 2006
Location: Monroe, WI
Posts: 348
Holy crap, you guys. You turned my brain into a soup sandwich. I'm not this technically inclined when it comes to computer stuff. It's taken me 3 years just to learn how to use imports.

I was thinking about moving to Win7 x64 and throwing in a 2x2 or 2x3 or something memory so I wouldn't run into a JVM issue. Souns like 2600mb is the limit regardless though?
__________________
Windows 10
Sagetv 9 64bit (9.2.5)
HVR-2255 x3 OTA
Reply With Quote
  #14  
Old 11-08-2009, 09:55 PM
Fuzzy's Avatar
Fuzzy Fuzzy is offline
SageTVaholic
 
Join Date: Sep 2005
Location: Jurupa Valley, CA
Posts: 9,957
Quote:
Originally Posted by stuckless View Post
See... isn't that a lot more constructive than your original... "Java sucks... I wish sage were .net" (i paraphrased)
I wasn't trying to start some conversation about JVM vs. CLR, as it's really moot in regards to sage... i was merely trying to answer Stanger's question accurately, with 'no-one seems to be able to figure out where the JVM max comes from'.
__________________
Buy Fuzzy a beer! (Fuzzy likes beer)

unRAID Server: i7-6700, 32GB RAM, Dual 128GB SSD cache and 13TB pool, with SageTVv9, openDCT, Logitech Media Server and Plex Media Server each in Dockers.
Sources: HRHR Prime with Charter CableCard. HDHR-US for OTA.
Primary Client: HD-300 through XBoxOne in Living Room, Samsung HLT-6189S
Other Clients: Mi Box in Master Bedroom, HD-200 in kids room
Reply With Quote
  #15  
Old 11-08-2009, 10:10 PM
stuckless's Avatar
stuckless stuckless is offline
SageTVaholic
 
Join Date: Oct 2007
Location: London, Ontario, Canada
Posts: 9,713
Quote:
Originally Posted by craigap View Post
Holy crap, you guys. You turned my brain into a soup sandwich. I'm not this technically inclined when it comes to computer stuff. It's taken me 3 years just to learn how to use imports.

I was thinking about moving to Win7 x64 and throwing in a 2x2 or 2x3 or something memory so I wouldn't run into a JVM issue. Souns like 2600mb is the limit regardless though?
I seriously doubt you need to bump it to 2600 (I only did it to see if i could).... personally I would start with 768m or 1024m and only increase it if you need absolutely need to. If you set it to the max that your system can allocate, then you may cause some unwanted side effects in other areas.

As a rule of thumb, I tend to set the Sage max memory to 256mb (which is their base) * the number of of concurrent extenders. (that calculation may be a bit aggressive, but it also doesn't account for plugins, etc, so it may all work well in the end)
Reply With Quote
  #16  
Old 11-09-2009, 04:50 PM
david1234 david1234 is offline
Sage Aficionado
 
Join Date: Nov 2007
Location: Beaverton, OR
Posts: 313
Quote:
Originally Posted by Fuzzy View Post
2. The JVM will never release memory back to the operating system.

Admittedly, this is probably based on the original incarnations of Java being designed primarily for smaller applets, that usually have fixed memory footprints, it doesn't scale well to large dynamic apps like sage.
This could be a religious discussion about memory management

The idea is that if the app needs that much memory it will need that much again, and so it holds onto the memory that it assumes it will need later on. The the application is allowed to grow to the size it needs, and over time it will sort of hit equilibrium.
Reply With Quote
  #17  
Old 11-09-2009, 04:59 PM
Fuzzy's Avatar
Fuzzy Fuzzy is offline
SageTVaholic
 
Join Date: Sep 2005
Location: Jurupa Valley, CA
Posts: 9,957
Quote:
Originally Posted by david1234 View Post
This could be a religious discussion about memory management

The idea is that if the app needs that much memory it will need that much again, and so it holds onto the memory that it assumes it will need later on. The the application is allowed to grow to the size it needs, and over time it will sort of hit equilibrium.
right, I agree that was the IDEA.. but in practice, with an app like sage, it's not the case. For basic sage UI functions, and such, yes, it would use a fairly static set of memory, however, with the newer graphically intensive imports, it simply doesn't work that way. The memory is only needed when the import is being displayed, and is garbaged out when done... however, since java doens't release it to the OS, it takes up unusable space in the memory pool. Yes, it DOES get swapped out to disc after it's been unused for a bit, however, this just means that to re-use that already allocated heap space, windows has to swap IN the effectively empty pages before it can be 'used' again. In a more flexible paradigm (CLR), when more memory was needed, it would simply allocate it from the 'standby' portion of physical RAM, so it would be immediately available to the application, instead of waiting on the pointless swapping.
__________________
Buy Fuzzy a beer! (Fuzzy likes beer)

unRAID Server: i7-6700, 32GB RAM, Dual 128GB SSD cache and 13TB pool, with SageTVv9, openDCT, Logitech Media Server and Plex Media Server each in Dockers.
Sources: HRHR Prime with Charter CableCard. HDHR-US for OTA.
Primary Client: HD-300 through XBoxOne in Living Room, Samsung HLT-6189S
Other Clients: Mi Box in Master Bedroom, HD-200 in kids room
Reply With Quote
  #18  
Old 11-09-2009, 05:02 PM
stanger89's Avatar
stanger89 stanger89 is offline
SageTVaholic
 
Join Date: May 2003
Location: Marion, IA
Posts: 15,188
Quote:
Originally Posted by stuckless View Post
Ok... now i really see

I guess i've never hit the upper limit, but, just to test this on my machine, I could create a machine at 2600mb... but not at 2700... and I think you are right, that the limit will vary from machine to machine depending on resources, etc. I think that java fails if it cannot allocate a contiguous block of memory.
Yes exactly. How did you get 2600MB? I tested using a for loop in a cmd prompt: for /l %i in (1000,100,2000) do java -Xmx%im -version

That will print out the version info if successful and fail if it can't create the VM. I've never been able to get anything over about 1600MB, even though the test machine is W7 x64 with 6GB of ram.

Quote:
I'm guessing the bmt issue was related to the dvd profiler xml... that's a very large file, and bmt uses a DOM parser (not smart) and so it has to cram it all into memory.
You don't need to rub it in It's also probably got something to do that I errantly pointed Sage to import a few hundred thousand media items

And the DOM parser made sense for the way it was used originally. Any interest in a SAX parser?
Reply With Quote
  #19  
Old 11-09-2009, 07:34 PM
stuckless's Avatar
stuckless stuckless is offline
SageTVaholic
 
Join Date: Oct 2007
Location: London, Ontario, Canada
Posts: 9,713
Quote:
Originally Posted by Fuzzy View Post
Yes, it DOES get swapped out to disc after it's been unused for a bit, however, this just means that to re-use that already allocated heap space, windows has to swap IN the effectively empty pages before it can be 'used' again. In a more flexible paradigm (CLR), when more memory was needed, it would simply allocate it from the 'standby' portion of physical RAM, so it would be immediately available to the application, instead of waiting on the pointless swapping.
I've never fully understood the flaw in windows that makes it swap out "aged" memory, just because it hasn't been accessed for a bit. I have a windows machine 4 gigs of memory and it's always put stuff out to swap. In linux, I have 4 gigs of memory and I never have anything in swap and the machine is always super responsive, even when I minimize an app for a few days and then finally focus it. Can the windows swap be optimized to for better performance?

Quote:
Originally Posted by stanger89 View Post
Yes exactly. How did you get 2600MB? I tested using a for loop in a cmd prompt: for /l %i in (1000,100,2000) do java -Xmx%im -version

That will print out the version info if successful and fail if it can't create the VM. I've never been able to get anything over about 1600MB, even though the test machine is W7 x64 with 6GB of ram.
I didn't anything quite a fancy... I just used the command line and keep doubling memory with each new command. I just use the up arrow and change the mem arg until it fails. Once it fails, I just half the difference and then try again... usually in about 8 tries, I have the approx value, which for me was ~2600 (I didn't try 2601, etc)


Quote:
And the DOM parser made sense for the way it was used originally. Any interest in a SAX parser?
That why I used the DOM parser as well... I think eventually I'm going to change to using dom4j and take advantage of their sax/dom hybrid parsing... or just switch to using sax. I tend to use sax for most things.
Reply With Quote
  #20  
Old 11-09-2009, 07:46 PM
stanger89's Avatar
stanger89 stanger89 is offline
SageTVaholic
 
Join Date: May 2003
Location: Marion, IA
Posts: 15,188
Quote:
Originally Posted by stuckless View Post
I've never fully understood the flaw in windows that makes it swap out "aged" memory, just because it hasn't been accessed for a bit. I have a windows machine 4 gigs of memory and it's always put stuff out to swap. In linux, I have 4 gigs of memory and I never have anything in swap and the machine is always super responsive, even when I minimize an app for a few days and then finally focus it. Can the windows swap be optimized to for better performance?
I think, but I don't have a clue where I came up with this, that it probably comes from the days of systems with very little memory, and the idea being to "proactively" move data to swap so that you don't get stuck waiting for the disk write (swap) to happen when/if you start a new app/process that needs more memory.

Of course this makes no sense anymore when 12GB of memory costs only $200

Quote:
I didn't anything quite a fancy... I just used the command line and keep doubling memory with each new command. I just use the up arrow and change the mem arg until it fails. Once it fails, I just half the difference and then try again... usually in about 8 tries, I have the approx value, which for me was ~2600 (I didn't try 2601, etc)
But are you running standard 32bit Java? Which version? What OS? How much memory? Mainly curious, I've read the max VM size possible is theoretically ~1900MB.

Quote:
That why I used the DOM parser as well... I think eventually I'm going to change to using dom4j and take advantage of their sax/dom hybrid parsing... or just switch to using sax. I tend to use sax for most things.
I forget, are you using DVDPro2Sage or did you roll your own DOM parser? I've got a working but not thoroughly tested, and not worked on for a while SAX parser.
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
Post Your Java Heap Settings HuMan321 SageTV Software 9 05-20-2009 08:36 PM
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 12:48 PM.


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