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.
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 overriderealloc
in order to temporarily change the memory permissions, perform the copy, and then change the permissions back.