[Openmcl-devel] Decreasing the size of the reserved heap
R. Matthew Emerson
rme at clozure.com
Thu Jan 9 10:44:10 PST 2014
On Jan 9, 2014, at 12:28 PM, Tim Bradshaw <tfb at tfeb.org> wrote:
> 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.
Sorry if I'm restating an obvious point, but when CCL wants to use some of the address space that it mapped with MAP_NORESERVE, it changes that portion of the mapping (thereby causing actual VM consumption), and can signal an out-of-memory error if that remapping fails.
More information about the Openmcl-devel
mailing list