This paper on a malloc() replacement that DOES COMPACTION even on C/C++ is making the rounds: https://arxiv.org/pdf/1902.04738.pdf
@federicomena Ooh, that's clever. I was ready to ramble about how that can already work at the OS level but they addressed that concern right away and added another layer to it that cleverly fixes the problem with that.
@fluffy I'm boggling at the part where it installs a segfault handler to catch writes to pages that it is in the process of compacting. Truly a lovely, scary hack.
@federicomena @fluffy I was thinking about this with my “occasional contributor to glibc” hat on, and the issue there is that signal handlers are process globals, which means libraries mustn’t touch them. Also, come to think of it, nothing stops you from using sigprocmask to block delivery of SIGSEGV and (hurriedly writes test program) this causes both Linux and BSD kernels to kill the process instead of invoking a handler.
@zwol @federicomena yeah that’s absolutely fair and I would expect anyone who’s using this allocator to specifically know they’re doing it and only use LD_PRELOAD as a reliable means of overriding the libc one. Because overriding a default allocator in C++ at the language level is a gigantic pain in the butt.
@federicomena @fluffy as another thing https://sourceware.org/git/?p=glibc.git;a=blob;f=nptl/allocatestack.c;hb=HEAD#l1120 can do. (yes, it's horrible.)
The original server operated by the Mastodon gGmbH non-profit