Core Dumps MacOS huge size

I am working on an application for MacOS. There I would like to store core dumps. But doing some tests I have seen that core files generated for MacOS are huge (more than 1 GB). Is there any way, programatically to tell OS to generate smaller core files?



I have seen function setrlimit, with parameter RLIMIT_CORE documentation says it reduces core size. But what information will leave out to make file smaller? Can someone give some hints here?


Also I have tried to change limits size giving different value instead of RLIM_INFINITY but then core dump is not generated


struct rlimit limit;

limit.rlim_cur = RLIM_INFINITY;

limit.rlim_max = RLIM_INFINITY;

return setrlimit(RLIMIT_CORE, &limit) == 0;


Can someone help me on this?


Thanks in advance