4

What are the best methods to reduce a core dump's size?

My problem is that I have very little space dedicated to the purpose on my Linux Mint. I have around 200 MB which is far not enough for my program to generate a decent dump. I have tried configuring the coredump filter, but only the anonymous private mappings dump made any significant change in the size, but it also made my dump unreadable. I also tried to limit the size with ulimit, but the only result was that dump was truncated every single time.

My question is that what is the best way to control the core dump's size? Is there any way to keep only maybe the top 10-15 frames of a dump? Also what is the use of setting the size limit with ulimit, if it only generates useless core files?

Carlos
  • 65
  • 2
  • 5
  • It might be simpler to have more disk space. You might even try plugging some cheap USB key (with some Ext4 filesystem on it), and run your program in it. – Basile Starynkevitch May 06 '15 at 15:42
  • @BasileStarynkevitch Unfortunately that's not an option. I'm very limited with hardware in this case. That's actually the root of the problem. – Carlos May 07 '15 at 08:46

2 Answers2

4

Consider using Breakpad: https://code.google.com/p/google-breakpad/ https://code.google.com/p/google-breakpad/wiki/GettingStartedWithBreakpad :

Breakpad is a library and tool suite that allows you to distribute an application to users with compiler-provided debugging information removed, record crashes in compact "minidump" files, send them back to your server, and produce C and C++ stack traces from these minidumps. Breakpad can also write minidumps on request for programs that have not crashed.

MK.
  • 33,605
  • 18
  • 74
  • 111
0

It appears that there are several related answers here on StackOverflow:

Minimal core dump (stack trace + current frame only)

This link suggests setting up a signal handler for SIGSEGV and dumping core in your own way.

and

Linux core dumps are too large!

This link suggests using setrlimit to limit the size of the dump.

Community
  • 1
  • 1
timato
  • 184
  • 2
  • 12
  • Simply setting a size limit for the core only results in it getting truncated, which, as far as my knowledge goes, is useless. About the other method, I'm not really familiar with writing signal handlers but I'll try it, thank you! – Carlos May 07 '15 at 12:31