News for hackers. Stuff that matters.
Re:Tinyalloc: replacement for malloc/free in unmanaged, line... by monocasa on Sunday January 06, 2019 @02:15PM (#18839993)
Yeah, but it's nicer to define that kind of stuff in your linker script IMO, where sizes of large memory regions can be thought of holistically.
Re:Tinyalloc: replacement for malloc/free in unmanaged, line... by CyberDildonics on Sunday January 06, 2019 @03:27PM (#18840453)
The parent post was talking about using malloc once at the start of the program, are you talking about defining that with your linker script?

Also if the goal is to get one chunk of memory with a single call, why use malloc at all? Why not use the direct memory mapping command?

Re:Tinyalloc: replacement for malloc/free in unmanaged, line... by monocasa on Sunday January 06, 2019 @04:01PM (#18840688)
I don't think he's talking about using malloc "once", he's talking about only using it during init. In practice you end calling it a bunch in that model, the last design I shipped like that ended up making a few hundred malloc (well new operator because this was C++) calls at init.

Under that system malloc/new was just a pointer bump, and an assert if there wasn't enough room. Free wasn't linked, and delete asserted. That heap region (or mine had several heaps that lived in different memory with different characteristics that could be specified with a new overload) is way easier to define in your linker.