Solution for linux core diagnostic files occupying storage space

linux core 诊断文件占用存储空间的解决方案

Background introduction

When the program exits abnormally under Linux, the kernel will generate a core file (a memory image, plus debugging information) in the current working directory. Using gdb to view the core file can indicate the file and line number of the code that caused the program to fail.

an examination

Use this command to check the current settings

 ulimit -c

If the result is 0, it means that this function is turned off and the core file will not be generated.

If the result is unlimited, it means unlimited generation.

QQ%E5%9B%BE%E7%89%8720220917222805.png

There is nothing else to say, just look at the reference materials for yourself

Adjustment

Use this command to adjust the quota (the unit of filesize is kbyte)

 ulimit -c filesize

You can also extreme infinite or closed

 ulimit -c 0
 ulimit -c unlimited

Phenomenon

For example, I encountered a lot of garbage taking up storage space

QQ%E5%9B%BE%E7%89%8720220917222944.png

References

linux: core file generation and debugging

This article is reprinted from https://www.blueskyxn.com/202209/6592.html
This site is for inclusion only, and the copyright belongs to the original author.