[Openmcl-devel] Decreasing the size of the reserved heap

Tim Bradshaw tfb at tfeb.org
Thu Jan 9 09:28:15 PST 2014


On 9 Jan 2014, at 16:12, Gary Byers wrote:

> Gee, I don't remember ... I'd have to LOOK AT THE SOURCE, wouldn't I ?

I apologise: I was being British and reticent (which I'm allowed to be, I am British and reticent) and not saying quite what I meant.  I had checked the source and noticed you're using MAP_NORESERVE, which I didn't know about previously.  MAP_NORESERVE worries me (not in the CCL context, in my day-job context) because it looks to me like it can be used to make systems which are otherwise safe, in the sense of `you always know who to blame when you run out of memory', not be so, unless the OS can be told to ignore it or there was some other subtlety I was missing which you knew about.

And (this is now offtopic probably) I've just convinced myself after some reading that actually MAP_NORESERVE is OK, so long as the OS *does* reserve swap for people who don't use it (which I'm pretty sure is the case for Linux kernels now, with suitable configuration, anyway).  A shortfall can only happen due to an attempted allocation failing (in which case you know it's due to the allocation) or because one of the people who allocated with MAP_NORESERVE has touched too much memory.  In that case you don't know who to blame but you *do* know it wasn't someone who didn't use MAP_NORESERVE, so none of them will be wrongly blamed.

--tim


More information about the Openmcl-devel mailing list