What's the story for using the system allocator in a no_std staticlib / binary (one that doesn't want to depend on std because of the networking / threading dependencies std brings with it, but that does depend on libc)? Copying even just one impl GlobalAlloc for System from std (e.g. the unix one) seems very undesireable.
Imagine you're working on an embedded device. The manufacture of that device provides some C libraries and also a malloc and free implementation (imagine it is really complex how to allocate memory on that system).
Instead of reimplementing it in Rust, you can just use the "system allocator" by calling malloc/free of the provided library.
With that allocator you can use String, Vec, and many more.
No, but my question was answered on the GitHub issue. I specifically am not interested in something for a specific embedded system but rather in using what std already provides as std::alloc::System but without depending on the full standard library (because I would [ideally] like to only depend on libc, not other system libraries the std implementations for different platforms depend on, like Winsock2 on Windows or pthreads on unix-like systems). This is not currently possible, but I've found a much larger issue with no_std anyway that is currently very hard to avoid for me. (namely Incorrect dev-dependency feature resolution · Issue #1796 · rust-lang/cargo · GitHub)