3 ms·
Worse, it breaks all pointers since you can't guarantee `mmap` can give you the same address.
by o11c 3y ago
Worse, it breaks all pointers since you can't guarantee `mmap` can give you the same address.
- astrange 3y agoI think you could fixup the pointers if you tried. It's more or less the same problem as compacting GC.
- junon 3y agoYou can detect when it doesn't, though, I think. If memory serves you can request a specific memory address to mount it at and it'll do it if it's not already mapped. It should (in theory?) return an error in such a case, no?
- deciduously 3y agoI believe on conflict it will just fall back to placing it where it can by default. It will return the address it actually used, so you can catch the mismatch.
- kouteiheika 3y agoYou absolutely can, with `MAP_FIXED`. But it's not trivial to do because you'd have to handle the case where the rtld and/or the kernel has already put something in memory where you want to put down your map. So it'd be tricky to implement, but definitely possible.
- mike_hearn 3y agoThat can be fixed with a linker script, to reserve the range using ELF headers. But then you're going to hit other problems. This isn't a new idea. Presumably one of the reasons you're restarting your server is to upgrade it ...