ezrosent / allocators-rs

Allocators in Rust
Apache License 2.0
311 stars 28 forks source link

mmap-alloc: Change permissions before reallocing #83

Closed joshlf closed 7 years ago

joshlf commented 7 years ago

On non-Linux platforms, the default realloc implementation is used. This breaks when either of the read or write permissions is not configured because the default implementation allocates a new object and then manually copies the bytes from the old to the new. Thus, we need to override realloc in order to temporarily change the memory permissions, perform the copy, and then change the permissions back.