Open
Description
There are multiple aspects.
- Scheduling/timing: when it is permissible (e.g. we can't concurrently zero something in use), when it is last possible time (right before the objects are used). There are many policies (see Xi's work), and Concurrent Zeroing #17 also talks about this.
- Who does the zeroing: some VMs (e.g. OpenJDK) might have builtin zeroing. In this case, the core should avoid double zeroing for better performance. See Remove redundant zeroing for OpenJDK and V8 #384.
- Implementation of zeroing: we can use
bzero
,memset
, simple for-loops, non-temporal stores, etc. Also see Xi's work. - Whether zeroing is required: we don't need to zero freshly mmapped memory if the OS has already zeroed it. Remove redundant zeroing for OpenJDK and V8 #384 (comment)
We need a framework that allows us to implement different zeroing policies, avoid double zeroing (wrt VM or OS), and switch between different implementations of zeroing.