Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Nov 2, 2009, 08:14 PM   #1
Arathorn
macrumors newbie
 
Join Date: Nov 2009
Slow core dumping under OS X

Hi all,

I do a fair bit of BSDish development under OS X in C and C++, and inevitably get my fair share of segfaults. With coredumping enabled (ulimit -c unlimited), I find the kernel takes ages to actually produce a core - about 13 seconds for a trivial one-liner null pointer dereference in C on my 2GHz MBP, on 10.6.1:

$ echo 'main() { *(int *)(0) = 1; }' | gcc -x c - && time ./a.out
Bus error (core dumped)

real 0m12.746s
user 0m0.001s
sys 0m0.377s
$ ls -alh /cores/core.16181
-r-------- 1 matthew admin 256M 3 Nov 02:08 /cores/core.16181

I'm sure this didn't use to take so long - it's really annoying to wait around for >30s for a non-trivial program to dump core whenever something goes wrong. How does it compare for other folks? Is there some secret I'm missing for speeding this up? For comparison under Linux on parallels on the same box...:

$ echo 'main() { *(int *)(0) = 1; }' | gcc -x c - && time ./a.out
Segmentation fault (core dumped)

real 0m0.020s
user 0m0.000s
sys 0m0.000s
$ ls -alh core
-rw------- 1 matthew users 52K 2009-11-03 02:13 core

:-/
Arathorn is offline   0 Reply With Quote
Old Nov 3, 2009, 05:32 AM   #2
gnasher729
macrumors G5
 
gnasher729's Avatar
 
Join Date: Nov 2005
Quote:
Originally Posted by Arathorn View Post
Hi all,

I do a fair bit of BSDish development under OS X in C and C++, and inevitably get my fair share of segfaults. With coredumping enabled (ulimit -c unlimited), I find the kernel takes ages to actually produce a core - about 13 seconds for a trivial one-liner null pointer dereference in C on my 2GHz MBP, on 10.6.1:

$ echo 'main() { *(int *)(0) = 1; }' | gcc -x c - && time ./a.out
Bus error (core dumped)

real 0m12.746s
user 0m0.001s
sys 0m0.377s
$ ls -alh /cores/core.16181
-r-------- 1 matthew admin 256M 3 Nov 02:08 /cores/core.16181

I'm sure this didn't use to take so long - it's really annoying to wait around for >30s for a non-trivial program to dump core whenever something goes wrong. How does it compare for other folks? Is there some secret I'm missing for speeding this up? For comparison under Linux on parallels on the same box...:

$ echo 'main() { *(int *)(0) = 1; }' | gcc -x c - && time ./a.out
Segmentation fault (core dumped)

real 0m0.020s
user 0m0.000s
sys 0m0.000s
$ ls -alh core
-rw------- 1 matthew users 52K 2009-11-03 02:13 core

:-/
The answer to the "why" is staring right at you:

-r-------- 1 matthew admin 256M 3 Nov 02:08 /cores/core.16181
-rw------- 1 matthew users 52K 2009-11-03 02:13 core

I think MacOS X has some debugging tools that are preferable to core dumps.
gnasher729 is offline   0 Reply With Quote
Old Nov 4, 2009, 08:12 AM   #3
Arathorn
Thread Starter
macrumors newbie
 
Join Date: Nov 2009
Quote:
Originally Posted by gnasher729 View Post
The answer to the "why" is staring right at you:

-r-------- 1 matthew admin 256M 3 Nov 02:08 /cores/core.16181
-rw------- 1 matthew users 52K 2009-11-03 02:13 core

I think MacOS X has some debugging tools that are preferable to core dumps.
Yup, I had spotted the difference in core size - and indeed it takes 8 seconds to dump 256M of /dev/zero to disk on my MBP, so that's where the majority of the time is going. My question was more whether there were options to pare down the size of the core file. Or what the debugging tools actually are which are preferable to core dumps
Arathorn is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Worth dumping money into? puma1552 MacBook Pro 4 May 19, 2014 06:52 PM
MacPro Quad Core 32g Ram running slow Logic using only 9g in Activity Monitor julian6400 Mac Pro 3 Jun 27, 2013 04:55 AM
Dumping armv6 support firewood App Store Business, Legal and Marketıng 2 Sep 19, 2012 03:25 PM
Are a lot of people dumping accessories? Michael CM1 iPhone 1 Sep 15, 2012 08:13 AM
12 Core Mac Pro - Super Slow Internet? destinybrandon Mac Pro 11 Sep 1, 2012 05:28 AM

Forum Jump

All times are GMT -5. The time now is 06:03 AM.

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

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