Go Back   MacRumors Forums > Apple Hardware > Apple TV and Home Theater

Reply
 
Thread Tools Search this Thread Display Modes
Old Jan 27, 2012, 10:46 PM   #1
thunderboltspro
macrumors regular
 
Join Date: Oct 2009
Location: Midwest
Help with handbrake with leaking memory.

Been using handbrake for awhile now but once i've upgraded to lion, i've been having issues with my system running out of memory, (8 gigs). its leaking from inactive memory.
I searched the web and couldn't find anything about it except this but doesn't lead me to an answer
https://forum.handbrake.fr/viewtopic...memory#p100821

Something to do with lion disk caching but I still can't find a solution to the problem.

Help help pretty please!!!!
__________________
15"Macbook pro 2.53 GHz core 2 duo 4 GB 250GB:
13"white Macbook 2GHz core 2 duo 2 GB 320 HD: 32GB Ipod touch:
thunderboltspro is offline   0 Reply With Quote
Old Jan 28, 2012, 02:38 AM   #2
Sedulous
macrumors 65816
 
Sedulous's Avatar
 
Join Date: Dec 2002
Disappointing. I bought OS 10.7 recently (have not upgraded yet). Seems like Handbrake hasn't been updated in a while. Maybe they are working on a fix if someone pointed out the bug.
Sedulous is offline   0 Reply With Quote
Old Jan 28, 2012, 07:38 AM   #3
stordoff
macrumors regular
 
Join Date: Aug 2009
Quote:
Originally Posted by Sedulous View Post
Disappointing. I bought OS 10.7 recently (have not upgraded yet). Seems like Handbrake hasn't been updated in a while. Maybe they are working on a fix if someone pointed out the bug.
Try a nightly build. They are updated almost daily, but there is an increased risk of bugs existing.
stordoff is offline   0 Reply With Quote
Old Jan 28, 2012, 11:05 AM   #4
thunderboltspro
Thread Starter
macrumors regular
 
Join Date: Oct 2009
Location: Midwest
Quote:
Originally Posted by stordoff View Post
Try a nightly build. They are updated almost daily, but there is an increased risk of bugs existing.
Night build 720 is a nope. Is their something in lion i can turn off that wont make handbrake do this?
__________________
15"Macbook pro 2.53 GHz core 2 duo 4 GB 250GB:
13"white Macbook 2GHz core 2 duo 2 GB 320 HD: 32GB Ipod touch:
thunderboltspro is offline   0 Reply With Quote
Old Jan 28, 2012, 01:48 PM   #5
dynaflash
macrumors 68020
 
Join Date: Mar 2003
ITs possible that spotlight or time machine is trying to index your encode in progress ....

I run hb svn head daily on an mbp with only 4 GB of ram running lion and have no issues with memory leakage. I would suggest its another process actually using the memory.

.. and as said above .. use the latest nightly, it actually more stable than 0.9.5.
dynaflash is offline   0 Reply With Quote
Old Jan 28, 2012, 03:21 PM   #6
Sedulous
macrumors 65816
 
Sedulous's Avatar
 
Join Date: Dec 2002
Apple definitely changed the way spotlight indexes in Lion. It also seems like how a user installs Lion (clean vs. upgrade) makes a big difference in general. Again, I have not made the leap (I plan to once I finish a major project).

Maybe the OP could try to fix permissions (use Disk Utility) and see if that helps? I have heard that helps with various performance issues.
Sedulous is offline   0 Reply With Quote
Old Jan 28, 2012, 05:36 PM   #7
thunderboltspro
Thread Starter
macrumors regular
 
Join Date: Oct 2009
Location: Midwest
Quote:
Originally Posted by Sedulous View Post
Apple definitely changed the way spotlight indexes in Lion. It also seems like how a user installs Lion (clean vs. upgrade) makes a big difference in general. Again, I have not made the leap (I plan to once I finish a major project).

Maybe the OP could try to fix permissions (use Disk Utility) and see if that helps? I have heard that helps with various performance issues.

Repaired both disc permissions and disk.
Downloaded tinker tool systems and played around with application related catches.

Did a fresh install of lion when it came out on mbp and used migration from a time machine back up for my apps and settings. Acquired a mac mini server and migrated my settings and apps on to it.

Tomorrow I will try a fresh install of lion on my laptop and not install anything extra except handbrake and sees if that fixes it or somewhere on my time machine backup has gone funky.
__________________
15"Macbook pro 2.53 GHz core 2 duo 4 GB 250GB:
13"white Macbook 2GHz core 2 duo 2 GB 320 HD: 32GB Ipod touch:
thunderboltspro is offline   0 Reply With Quote
Old Jan 28, 2012, 08:45 PM   #8
Sedulous
macrumors 65816
 
Sedulous's Avatar
 
Join Date: Dec 2002
Quote:
Originally Posted by thunderboltspro View Post
Repaired both disc permissions and disk.
Downloaded tinker tool systems and played around with application related catches.

Did a fresh install of lion when it came out on mbp and used migration from a time machine back up for my apps and settings. Acquired a mac mini server and migrated my settings and apps on to it.

Tomorrow I will try a fresh install of lion on my laptop and not install anything extra except handbrake and sees if that fixes it or somewhere on my time machine backup has gone funky.
I have no idea if it will help but if you are up for it, might as well try. Just strange that some people noted no Handbrake memory leak in Lion... so that is why I suggested maybe it is a bug unique to your Lion installation. Hope it works.
Sedulous is offline   0 Reply With Quote
Old Jan 28, 2012, 11:47 PM   #9
chrono1081
macrumors 604
 
chrono1081's Avatar
 
Join Date: Jan 2008
Location: Isla Nublar
Quote:
Originally Posted by thunderboltspro View Post
Repaired both disc permissions and disk.
Downloaded tinker tool systems and played around with application related catches.

Did a fresh install of lion when it came out on mbp and used migration from a time machine back up for my apps and settings. Acquired a mac mini server and migrated my settings and apps on to it.

Tomorrow I will try a fresh install of lion on my laptop and not install anything extra except handbrake and sees if that fixes it or somewhere on my time machine backup has gone funky.
If its a real memory leak this won't do anything. A memory leak is caused when a programmer is allocating memory on the heap and never deallocates it. The most you can do is try a nightly build or submit a bug report to the makers of handbrake.
__________________
Mac Pro (2010): 3.33Ghz Intel Xeon (6 core) - 24 GB RAM - NVidia Quadro k5000
Macbook Air (2010): 2.13 Ghz Intel Core 2 Duo - 4GB RAM
chrono1081 is offline   0 Reply With Quote
Old Jan 30, 2012, 09:14 AM   #10
thunderboltspro
Thread Starter
macrumors regular
 
Join Date: Oct 2009
Location: Midwest
Quote:
Originally Posted by Sedulous View Post
I have no idea if it will help but if you are up for it, might as well try. Just strange that some people noted no Handbrake memory leak in Lion... so that is why I suggested maybe it is a bug unique to your Lion installation. Hope it works.
Reinstall of lion did nothing new, oh well i guess i'llkeep playing with the night builds and hope it gets fixed.
__________________
15"Macbook pro 2.53 GHz core 2 duo 4 GB 250GB:
13"white Macbook 2GHz core 2 duo 2 GB 320 HD: 32GB Ipod touch:
thunderboltspro is offline   0 Reply With Quote
Old Jun 2, 2012, 06:38 AM   #11
Skoopman
macrumors 6502
 
Join Date: Sep 2011
Location: Romania
Did somebody find a solution? I just started using Handbrake to convert some MKV to MP4 and the memory leak is driving me nuts. I can't just turn of spotlight every time I want to encode something.

Edit: Just tried out iFFmpeg, the inactive memory increases, too. The problem seems to be ffmpeg. I tried 0.102 and 0.11, both leak memory.
__________________
Macbook Air 13" | 1.8GHz | 4GB RAM | 128GB SSD
Time Capsule 2TB
Apple TV 3

Last edited by Skoopman; Jun 2, 2012 at 10:50 AM.
Skoopman is offline   0 Reply With Quote
Old Jun 4, 2012, 11:01 AM   #12
dynaflash
macrumors 68020
 
Join Date: Mar 2003
Quote:
Originally Posted by Skoopman View Post
Did somebody find a solution? I just started using Handbrake to convert some MKV to MP4 and the memory leak is driving me nuts. I can't just turn of spotlight every time I want to encode something.

Edit: Just tried out iFFmpeg, the inactive memory increases, too. The problem seems to be ffmpeg. I tried 0.102 and 0.11, both leak memory.
you are aware that handbrake uses the libav fork of ffmpeg not ffmpeg ?

btw, I run hb 0.9.6 and nightlies daily on a lion install and have not observed said mem leak.
dynaflash is offline   0 Reply With Quote
Old Jun 4, 2012, 11:11 AM   #13
ljonesj
macrumors 6502a
 
ljonesj's Avatar
 
Join Date: Oct 2009
Location: Kingsport TN
and try this turn off spotlight if your encoding to a external drive i only have spotlight for my itunes firewire drive and my main system drive as those are the ones i have hard time finding stuff a lot of times
__________________
acer win 7 3.0ghz amd dc 4gb ram; mac mini late 09 2.53ghz 8 gb of ram now with 500gb hard drive; mid 2010 macbookpro 13 base model with 500gb 7200 hybrid drive in place of the 250
ljonesj is offline   0 Reply With Quote
Old Jun 4, 2012, 07:48 PM   #14
Alrescha
macrumors 65816
 
Join Date: Jan 2008
Location: Boston, MA
Quote:
Originally Posted by Skoopman View Post
the inactive memory increases
Inactive memory is essentially free memory that nothing wants yet.

Apart from what you see in Activity Monitor (or whatever), what are the symptoms? What's crashing/failing/not working?

A.
Alrescha is offline   0 Reply With Quote
Old Jun 5, 2012, 02:23 AM   #15
Skoopman
macrumors 6502
 
Join Date: Sep 2011
Location: Romania
I don't encode to an external drive, but to the same hard disk in the Mini.

The problem is that the paging out is slowing down the mini. I had nearly 50% page outs compared to page ins. What happens after the encoding: If I delete the original MKV file and trash it, the memory is released. But what if I don't want to trash the file? I talked to the developer of iFFmpeg and we couln't find a solution. He thinks that OS X has some difficulty to release writing permissions to files. I might have to install Lion again.
__________________
Macbook Air 13" | 1.8GHz | 4GB RAM | 128GB SSD
Time Capsule 2TB
Apple TV 3
Skoopman is offline   0 Reply With Quote
Old Jun 5, 2012, 10:32 AM   #16
Alrescha
macrumors 65816
 
Join Date: Jan 2008
Location: Boston, MA
Quote:
Originally Posted by Skoopman View Post
I had nearly 50% page outs compared to page ins.
What happens if you go to a Terminal window and type 'purge' instead of trashing the file after an encode?

A.
Alrescha is offline   0 Reply With Quote
Old Jun 5, 2012, 05:25 PM   #17
Skoopman
macrumors 6502
 
Join Date: Sep 2011
Location: Romania
Quote:
Originally Posted by Alrescha View Post
What happens if you go to a Terminal window and type 'purge' instead of trashing the file after an encode?

A.
The inactive RAM is released. But I can't use purge every time. If I want to encode let's say 10 movies over night, the RAM will get full after one movie and will page the hell out. Anyway, I will get a Time Capsule this week, move my files there and install Lion again.
__________________
Macbook Air 13" | 1.8GHz | 4GB RAM | 128GB SSD
Time Capsule 2TB
Apple TV 3
Skoopman is offline   0 Reply With Quote
Old Jun 10, 2012, 10:52 PM   #18
bearcatrp
macrumors 68000
 
Join Date: Sep 2008
Location: Boon Docks USA
Write to another disc (scratch disk). Makes a difference. When your reading and writing to the same disk, your encode speed will suffer. Reading from one disc and writing to another does help out allot. When your paging out, thats time reading and writing to the same disk again. BTW, how full is your hard drive?
__________________
2010 2.66 Mac Mini(SL), ATV3, iPhone 6P, Dual X5670 2.93 Westmere Win7 PC w/48gb ram & 4930K w/32gb ram Win7.
bearcatrp is offline   0 Reply With Quote
Old Jun 24, 2012, 05:45 PM   #19
eford
macrumors newbie
 
Join Date: Jun 2012
May not be a Lion problem

I don't believe this has anything to do with Lion. I am still using Snow Leopard on my IMac and MacBookPro and within the last month or so my IMac system will flicker then freeze when using HandBrake and simultaneously watching another video. Oddly enough, the audio continues to play after the display has frozen but all system control and input is lost. I have to force a power off to regain use of the system. It also freezes shortly after the screen saver is activated when using HandBrake with no other software in use. I have this problem whether I'm using the internal harddrive or external USB drive. I checked Activity Monitor with only HandBrake running and noted that HandBrake is showing 197% CPU usage. I thought it might be due to a possible recent update to HandBrake so I reverted to using the 2008 (.9.3.0) version and the problem still occurs. I have all of the same software on my MacBookPro but have never encountered the problem on that system. I've tested the MacBookPro with all of the same files.
eford is offline   0 Reply With Quote
Old Nov 4, 2012, 03:08 PM   #20
jig1056
macrumors newbie
 
Join Date: Nov 2010
Free up the inactive memory using a Bash script

I'm running Mountain Lion and I'm having the exact problem. Doesn't seem to be a Lion issue, it's an issue with Handbrake. Also this is a clean install of Mountain Lion , it was not upgraded from Lion. As mentioned in a previous post running the purge command in terminal frees up the inactive memory and allows Handbreak to work as expected. And of course you can't sit at your machine and keep manually running the command so I wrote a quick and dirty Bash script to purge the inactive memory.

This script polls the inactive memory and and runs the purge command if it goes above 1000 MB. It checks the memory every 5 mins. This is a very simple script but it does exactly what we need it to do. Time permitting I'll incorporate it into an automator script that will allow you to run it by clicking on it from your desktop.

Here is link to the actual UNIX script.
https://skydrive.live.com/redir?resi...Nk9T9saentqYow

For our UNIX newbies do the following:
1) Save it to your harddrive
2) Open up terminal and navigate to the folder where you saved the file
3) Change the permission on the file, for ease of use use 777 "chmod 777 freemem.sh"
4) run the script using using the following syntax "sh freemem.sh"

**Note I have 16GB of memory, a threshold of 1000MB works for me but you may have to adjust for your machine.

Code:
#!/bin/bash

mem_threshold=1000

while [ 1 -le 2 ]
do	
     #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 the memory
	if [[ "$mem_inactive" -gt "$mem_threshold" ]]; then	
		echo "**************************"
		echo "Time $(date)"
  		echo "Threshold = $mem_threshold"    
  		echo "Inactive  = $mem_inactive" 
  		purge
  		echo "Memory purged"
  		echo " " 
	fi  

  	sleep 300  #In seconds 
done

Last edited by jig1056; Nov 4, 2012 at 07:06 PM. Reason: added step for changing the permission on the file
jig1056 is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Hardware > Apple TV and Home Theater

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Handbrake and your Memory? / Cpu Usage iOrbit Apple TV and Home Theater 11 Aug 1, 2013 10:53 PM
VPN + Utorrent leaking ring Mac Basics and Help 2 Jul 30, 2013 09:01 PM
Does my memory leaking? Folmanik MacBook Pro 26 Feb 2, 2013 08:07 PM
MapKit leaking Stefan51278 iPhone/iPad Programming 0 Dec 9, 2012 06:56 PM
Handbrake results on late 2012 2.3ghz quad with 4g of memory xlii Mac mini 11 Nov 6, 2012 11:26 PM

Forum Jump

All times are GMT -5. The time now is 02:36 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC