Pausing an application before exiting memory results in a segmentation error

I have a large application that allocates large amounts of memory using mallocand mmap. I want to catch all the failure methods and try and recover. To close the swap space replacement case, I check the return mallocand realloc, and if they are zero, the application may prompt the user to clear some disk space before continuing.

The application also allocates many large data arrays using mmap, using sparse files. I want to be able to recover from situations where writing to a memory card fails due to disk space restrictions. Is there a way to do this, or is it better for me to turn on disk space monitoring and stop the corresponding threads in this scenario.

Im running in c and the application should run on linux and solaris

+4
source share
2 answers

There is no way for the process to anticipate the fact that memory access will fail due to lack of virtual memory, especially using the small file model used.

sigsegv, (. ). / .

+3

, , , . RAM , , .

, .

0

Source: https://habr.com/ru/post/1569434/


All Articles