namefreezers wrote:

@tru, thanks for looking at this! I agree that nobody wants to maintain a fork, 
and I looked at doing this upstream first. Here is why I ended up proposing it 
here:

- Upstream has no 1.x branch. 1.4.5, the version LLVM vendors, is the last 1.x 
release (April 2024). `main` and `develop` are 2.x, which is a rewrite with a 
different heap layout, so this patch has no place upstream as it is.
- Upstream already has the equivalent for 2.x: `rpmalloc_thread_collect()` is 
implemented on `develop` (mjansson/rpmalloc#416, mjansson/rpmalloc#439). It 
isn't in a release yet: in 2.0.0 and 2.0.1 the function is still empty.

So "fix upstream and bump" here means moving the vendored copy from 1.4.5 to 
2.x once a release has it, which is a much bigger change than this one. I don't 
know of plans for that, so I assumed it won't happen any time soon.

The change to rpmalloc.c doesn't touch the allocation and free paths: it fills 
in the empty `rpmalloc_thread_collect()` and adds one function. A bump to 2.x 
would drop both, and `sys::Process::releaseHeapCaches()` would call upstream's 
`rpmalloc_thread_collect()` instead.

About mimalloc: as far as I can see, LLVM builds with it only from an external 
checkout with a prebuilt library (`LLVM_INTEGRATED_CRT_ALLOC`). To use it, the 
release would have to vendor or fetch it, and lld and clang would get the new 
allocator too. So switching allocators also looks like a bigger change than 
this patch. I haven't measured clangd with it.

Would it be OK to land this as a temporary fix until LLVM moves to rpmalloc 2.x?

https://github.com/llvm/llvm-project/pull/242843
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to