Memory issue - OS X

Archive of historical bug reports.
Please use the GitHub link above to report issues.
Forum rules
*******************************
Please be aware we are now using GitHub for issue tracking and feature requests.
- This section of the forum is now closed to new topics.

*******************************
Post Reply
macmuchmore
Posts: 6
Joined: Tue May 21, 2013 5:10 pm

Memory issue - OS X

Post by macmuchmore »

-0.9.9
-5/19/13
-Location of Download: HandBrake Site
-Platform: Mac
-Settings: used Blu-Ray default
-OS X 10.7.5
-If possible, a crash report: did not crash
-Not a DVD - converting a MKV file
-What you were doing at the time besides encoding: Nothing
-What other applications were running: None
-Whether or not the problem is reproducible (happens every time with the same settings/movie): Happens every time - on every MKV file I have tried (have not tried any other files)

Just wanted to report that the inactive memory keeps growing and growing until ALL of the free memory is inactive Approaches 24GB range - I have 32 GB of RAM. have to use the "purge" command in terminal to free it up, but then it starts building again. I am not sure is this is a problem or not.... but it definitely impacts performance.

Please let me know if you need additional info.
mduell
Veteran User
Posts: 8206
Joined: Sat Apr 21, 2007 8:54 pm

Re: Memory issue - OS X

Post by mduell »

This gets posted every few months. Please read up on your operating system's memory management.
macmuchmore
Posts: 6
Joined: Tue May 21, 2013 5:10 pm

Re: Memory issue - OS X

Post by macmuchmore »

Thanks - I already did and at a very high level understand the limitations of the OS X memory management... It just seems fairly application specific - meaning it is only happening with Handbrake and none of my other applications. I am not a developer or engineer so I cannot claim to understand how it all works, however it is logical to assume since it only happens with the one application that it is not an overall OSX memory management issue.... even if it is. Instead of just assuming, it would be nice if a developer who works on Handbrake actually checks into this just to make sure. mduell - if you are a developer and you have researched this, then great - thanks for the feedback. If you are not, then I just ask for a little more patience and hope that this is looked into. :-)
User avatar
s55
HandBrake Team
Posts: 10360
Joined: Sun Dec 24, 2006 1:05 pm

Re: Memory issue - OS X

Post by s55 »

It's not unexpected given the volume of uncompressed video moving in and out of memory. OSX's memory management seems rather crazy so this is the kind of stuff you got to deal with. It's by design behavior in the OS

There is a way to tell the OS that it's actually stale, but this would involve updates to a number of 3rd party libraries we use first, it may happen eventually but not anytime soon i doubt.
macmuchmore
Posts: 6
Joined: Tue May 21, 2013 5:10 pm

Re: Memory issue - OS X

Post by macmuchmore »

ok - thanks for the feedback mduell and s55. I will just hope Apple eventually manages their memory better! ;-)
martind57
Posts: 2
Joined: Wed Jul 10, 2013 1:27 am

Re: Memory issue - OS X

Post by martind57 »

Found this on MacRumors site which may help http://forums.macrumors.com/showthread.php?t=1315447. Download and launch the script at the end of the article and leave it running while Handbrake is working - it will clear your inactive memory every 5 minutes.

On my Mac with 10 GB RAM I've simplified the script and run in the background every 30 minutes using launchd. Running a very big batch encode (several hundred MKVs to MP4) over the past 24 hours and the Mac is now stable, whereas previously Handbrake would hang after 3 or 4 hours.

My version of the script:

Code: Select all

#!/bin/bash

mem_threshold=2000

#Get the current value for the inactive memory
mem=$(top -l 1 | grep PhysMem: | awk '{print $6}')
mem_inactive=`expr $mem |cut -f 1 -d'M'`
	
#If the inactive memory is greater than memory threshold purge inactive memory and log to system.log
if [[ "$mem_inactive" -gt "$mem_threshold" ]]; then	
  		purge
  		syslog -s -l Notice "Inactive memory = $mem_inactive"
  		syslog -s -l Notice "Memory purged"
	fi  
exit
Post Reply