4 ms·
How do you allocate memory without an allocator?
by ycombinatrix 9mo ago
How do you allocate memory without an allocator?
- tialaramex 9mo agoThe usual thing for languages is to provide a global allocator. That's what C's malloc is doing for example. We're not asked to specify the allocator, it's provided by the language runtime so it's implied everywhere. In standalone C, or Rust's no_std, there is no allocator provided, but most people aren't writing bare metal software.
- ycombinatrix 9mo agoThat creates problems when you need to use multiple allocators. IMO allowing an allocator to be specified is a superior design.
- MangoToupe 9mo agoIf you need multiple allocators, and you aren't already using lisp, who cares? Just use lisp. Anyone who can use allocators against the C abi can clearly see the benefits of using a language that can cater to the developer. Zig can never do this, yea even with its shallow macros. Zig will always be a shitty B knockoff rather than something artisans actually want to use
- MangoToupe 9mo agoYou call the use of memory something other than "allocation". Ez. I thought that passing down allocators was core to the language. I was mistaken. This is actually quite nice for writing allocation code when you'd like to opt into it.