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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
thread Thread Starter Forum Replies Last Post
Core i5 MacBook Pro SLOW Boot Time aaronhead14 MacBook Pro 27 Oct 6, 2011 01:34 PM
iPhone 3GS - BaseBand Core Dump In Progress rw3 iPhone 8 Jul 6, 2009 09:17 AM
Baseband core dump message MotionxxUSxx iPhone 1 Apr 26, 2009 11:18 AM
iPhone Core Dump in Progress!?? MatthewStorm iPhone 6 Apr 21, 2009 06:03 PM
Baseband Core Dump error msg 3.0 beta 2/3 OriginalMasta iPhone 0 Apr 15, 2009 09:12 PM


All times are GMT -5. The time now is 02:25 AM.

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

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