Core Dumps in Mac OS X

来源:互联网 发布:vue.js onchange 编辑:程序博客网 时间:2024/06/10 00:28

MAC磁盘不停的变大,以下是解决方案。可能会影响某些服务,具体原因不明。

http://krypted.com/mac-os-x/core-dumps-in-mac-os-x/

Every now and then, OS X has to drop some kids off at the pool. Usually it’s some developer that didn’t build a sanity check for every-single-possible-flippin’-thing-you-might-think-to-do-to-his/her-poor-flippin’-app-OMGYFI! And then, suddenly, out of nowhere, you get crap all over the system. Actually, as expected, Apple’s dumps are pretty well sequestered in the /cores directory. Each core file has a number appended behind it. For example, core.9901. When applications crash, they can save a lot of information about the state when they crashed into these files. For example, I have seen  cached passwords in there…

To disable core dumps, add the following line to /etc/sysctl.conf:

kern.coredump=0

After a restart core dumps will be disabled. You can also set the coredump setting to 0 to disable it live, using the sysctl command, but it will revert back to 1 at the next reboot:

sudo sysctl -w kern.coredump=0

Existing core files are removed using the following command:

sudo rm -f /cores/*

As core files actually serve a purpose, if an application or the system needs some good troubleshooting-foo, re-enable:

sudo sysctl -w kern.coredump=1


Disable core file dumps on Mac


https://blog.liplex.de/disable-core-file-dumps-on-mac/

Mac OS X is still based on UNIX. Therefore OS X uses a lot of UNIX features. One of them are core dumps which are basically file dumps of your working memory in the moment of an app crashing. It helps a developer to look into why an app crashed or for an app to retrieve the last working environment.

Recently I ran into a full hard drive and had to look into what takes up how much space. Turns out there where a lot of those core dumps. Over 145GB of them to be more exact!

They are located in your root folder at /cores. I just deleted all of them with:

$ rm -f cores/*

You can disable the dumping of those core files with the following command:

$ sudo sysctl -w kern.coredump=0

But this won't be persisted through a restart. To do so create a new file on /etc/sysctl.conf (if it does not exist yet) and write in the following configuration:

kern.coredump=0  



0 0
原创粉丝点击