I have a large application, that allocates large amounts of memory using malloc
and mmap
I want to trap all methods of failure and try and recover. To cover the case of running out of swap space, I check returns of malloc
and realloc
and if they're null, the application can prompt the user to clear some disk space before continuing.
The application also allocates many large data arrays using mmap
, using sparse files. I wish to be able to recover from situations where a write to mapped memory fails due to disk space limitations. Is there any way of doing this, or am I better off incorporating disk space monitoring and halting the relevant threads in this scenario.
Im working in c, and the application needs to run on linux and solaris