|
|
|
|
|
by dymk
2768 days ago
|
|
Nearly any command that you pipe into, or stream content out of, must to allocate and free memory in some non-trivial way. Sure, those commands could just allocate and never free memory (a-la early C compilers, or the D compiler), but now any use-case that involves a large amount of data will leak noticeably. Not going to fly if you need these commands to be durable and efficient. And unix commands need to be both. A GC gets you the freedom to operate on large streams for free, without having to worry about memory management (modulo optimization, but that happens later anyways, regardless of GC presence or not). |
|
* Some deal with only one pixel at a time, or sometimes two. No dynamic allocation is needed.
* Some deal with one scanline at a time, or sometimes more than one (but a fixed number) at a time. The same buffer can be used for each scanline.
* Some deal with the entire picture (such as those that distort the picture).
But one possibility can be that a program might load multiple pictures and each picture needing the entire picture at once, but does not use them simultaneously, in which case it is sense to free each picture after it is used.
(Or maybe I somehow misunderstood your message or something else.)