3 ms·
Many server architectures work like that, I know apache did/does. When you know you're working in a short term request it's an obvious optimization to allocate
by ajross 4y ago
Many server architectures work like that, I know apache did/does. When you know you're working in a short term request it's an obvious optimization to allocate from a "grows only" bucket that you then throw in the trash at the end of the request.
In fact, I think the truth is rather the converse. Users of "modern" frameworks and managed runtimes think of the heap as a unitary thing, provided by the runtime, with complicated rules and individual blocks being individually managed. "Old school C" was, in fact, a lot less constrained and a lot more willing to engage in novel paradigms. See the emacs first-stage elisp dump for another famous example of C programs breaking rules about how heaps are supposed to work.
- asah 4y agothis is an interesting point, i.e. malloc/free is perhaps one of those things that's great for getting started, but something you replace when going to scale and production.
- naasking 4y agoWeird, I think the exact opposite, ie. malloc/free is terrible for beginners. Fine grained resource management is hard.
- nabla9 4y agoIt's also classic game programming method. Just start a new process between every room, level, and so on. Let the OS do the memory management.
- deleted 4y ago[deleted]
- karmakaze 4y agoCHICKEN Scheme uses the stack as heap which "grows only" in continuation-passing style (CPS). When it hits the limit, only the live heap parts are copied to the new stack. [0] https://www.plover.com/~mjd/misc/hbaker-archive/CheneyMTA.html https://www.plover.com/~mjd/misc/hbaker-archive/CheneyMTA.ht...