On Wednesday, 30 October 2019 15.26.01 EDT Matthew Dillon wrote: > Generally speaking the allocation algorithm depends on the language, the OS > doesn't have a lot to do with it. Anything linked against libc (that is, > any C program), however, will use the allocator in libc which we do > control. That allocator allocates per-thread zones. > > That said, the memory allocator itself, no matter what the language, is > still just allocating memory that is shared across all the threads. No > copying is involved. All the threads share the same address space. Any > locking is up to the program (or the language) itself.
It's C++. My concern is whether there's a way to return the memory to the OS if it was allocated in a thread (say the program has been idle for a minute). In Linux, only the main thread can do that. The main thread allocates with brk; the other threads allocate with mmap. Pierre -- gau do li'i co'e kei do
