6

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

2
  • 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). Commented Jul 30, 2012 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. Commented Jan 19, 2013 at 8:46

2 Answers 2

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.

1
  • 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. Commented Apr 30, 2013 at 3:52
2

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.

3
  • sysdiagnose – good idea. Maybe allmemory alone will give the answers. Commented Jul 26, 2012 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. Commented Jul 26, 2012 at 22:41
  • 2
    Muahhhh aaaahhh ahhhh haaaaaa. You almost fell into my "all your free space will become log files" trap.
    – bmike
    Commented Jul 26, 2012 at 22:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .