I see your point. At some level
serverless is popular for this reason. You can just forget about memory leaks (like Vercel does with NextJS ;)
That said, the OS can be a lousy GC; for instance, POSIX-compliant Kernels may not clean up shm regions after processes.