Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

Maybe more noticeable in Lion and Mountain Lion, than in Snow Leopard and earlier versions of the operating system:

  • in safe mode, an unexpectedly large amount of wired memory.

Question

Why might more memory be wired in safe mode?

Example

Screenshots of Mountain Lion in safe and normal modes on a MacBookPro5,2 with 8 GB memory:

  • with a safe boot, more than 5 GB is wired after login
  • with a normal boot, less than 2 GB.

Links

Mac OS X: What is Safe Boot, Safe Mode?

What is wired memory?

Mac virtual memory: how to make OS X create swap (page) files as freely with a normal boot as it does with a safe boot (swapfile1 etc)

XNU questions in Stack Overflow

share|improve this question
    
Side note: if there's a delay in me accepting an answer on this one, it'll be because I can't easily start my Mac in safe mode (but I'm keeping that off-topic). –  Graham Perrin Jul 30 '12 at 10:57
    
Answers here are not forgotten! Last week I successfully booted in safe mode. I'm now looking at overall performance of the Mac and peripherals (mainly hard disk drives) with attention to dynamic_pager writes to permanent storage, both with and without safe boot. –  Graham Perrin Jan 19 '13 at 8:46

2 Answers 2

SafeBoot disables various kernel extensions including the GPU. The extra memory is likely being used for the display where it would normally be allocated to share with integrated graphics or be handled by a discreet graphics card.

share|improve this answer
    
A vote up for thought, but the graphics card alone can't explain it. I added to the question an example where there's a difference of more than 3 GB on a Mac with only 512 MB on the preferred card. –  Graham Perrin Apr 30 '13 at 3:52

Wiring code into RAM prevents it from being swapped to storage, so this might be a nice design tradeoff to wire critical components and frameworks to RAM so that the chance of a drive that fails to write data correctly will bring the system down.

Trading speed for stability would be a nice thing for safe mode to enhance it's ability to run in edge cases (drive totally full, drive failing, major software corruption). Even if this is not intentional, the safe boot does throw away (and does not recreate) the dynamic loader shared cache and that also might be a design reason to just pin each library needed into RAM. You would want to run sysdiagnose before, during and after a safe boot and might be able to see in memory allocation statistics if this makes up for your measured difference in RAM allocation.

I can't speak for the designers, but I would consider making this tradeoff if I were in their shoes and wanted to make Safe Mode as safe to run as possible.

share|improve this answer
    
sysdiagnose – good idea. Maybe allmemory alone will give the answers. –  Graham Perrin Jul 26 '12 at 22:33
    
Safe boot aside: where free space on a startup volume is critically low, I should not run sysdiagnose – the amount dumped to /private/tmp/allmemoryDataFiles can make a difficult situation worse. –  Graham Perrin Jul 26 '12 at 22:41
1  
Muahhhh aaaahhh ahhhh haaaaaa. You almost fell into my "all your free space will become log files" trap. –  bmike Jul 26 '12 at 22:44

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.