10 ms·
Unless you also need to free, it's pretty simple.
by std_throwaway 10y ago
Unless you also need to free, it's pretty simple.
- capnfantasic 10y agoOf course. When I wrote that comment I asked myself should I have written "malloc" or "malloc/free" - surely one implies the other.
- dom0 10y agoOh well, with 16 GB RAM even in laptops, who needs free anymore? Just restart the program. It's simpler anyway.
- makapuf 10y agoironic for a minimalist/anti bloat pamphlet to start with "with 16GB ..."
- marcosdumay 10y agoNot surely. Many programs are written in a way that allocates all the needed heap space at startup, and just reuse it forever. And those are overrepresented on the minimal-system kinds of environment.
- vidarh 10y agoFor short-lived processes that do lots of allocations and where you can rely on the OS to release resources, just leaving out the deallocations is often faster. Of course, you need to be careful as if you write code like that in a language without garbage collection, it's inherently not reuseable - retrofitting deallocation is often really painful because it gets easy to adopt patterns that make object ownership etc. unclear when you don't have to ensure it's easy to deallocate in the right order.
- shultays 10y agoAlso easy if your free/malloc is just a wrapper around munmap/mmap.