News for hackers. Stuff that matters.
Re:Rpmalloc – A lock-free memory allocator by faragon on Sunday March 19, 2017 @11:59AM (#13907844)
Realloc, if well implemented, does not copy (using virtual memory stuff).
Re:Rpmalloc – A lock-free memory allocator by hawski on Sunday March 19, 2017 @01:05PM (#13908251)
In this case would it work similarly to having single big mmap and counting on kernel allocating pages on first write? So for most cases you would only have a single mmap call and multiple page faults (as it would always be the case). I assume that most allocators do mmap for big allocations so it does not need to be called directly.

I lately tried very naive synthetic test to check when realloc will return different address (meaning that it had to copy). My system started swapping, but it did not return different address. I did not know that realloc works like that, but why wouldn't it.

Re:Rpmalloc – A lock-free memory allocator by hoytech on Sunday March 19, 2017 @01:14PM (#13908322)
> check when realloc will return different address (meaning that it had to copy)

What faragon is referring to is that this assumption is incorrect. The virtual address changing does not imply the memory was copied. On linux for example it could have been remapped with mremap(2).