See HN article for more detail. TL;DR, golang does not specify any particular semantics about memory addresses. Calling mlock on a go-managed memory address provide little to nothing in the way of guarantees, because that memory will be copied and moved around as the runtime sees fit.
This is pretty much unavoidable. The address you call mlock on isn't even guaranteed to be the address passed in via memlock.Lock(b).
See HN article for more detail. TL;DR, golang does not specify any particular semantics about memory addresses. Calling
mlockon a go-managed memory address provide little to nothing in the way of guarantees, because that memory will be copied and moved around as the runtime sees fit.This is pretty much unavoidable. The address you call
mlockon isn't even guaranteed to be the address passed in viamemlock.Lock(b).