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
source
share