

That is entirely a shit at managing memory problem.
If you have 1 MB of RAM left, firstly, your OS has not properly managed it’s resources. It should have reserved system RAM. Secondly, a good memory manager will have swapped out unused, or low priority pages.
And that’s not just a system issue. A well developed piece of software will unload (or never load) parts of the software that are not needed at runtime.
I’m going to give you a great example I just read about today, about bad programming practices. The install of Helldivers 2 has been reduced from 154GB to 23 GB. That’s a reduction of 85%. This was driven by de-duplication of code. So, while this is a storay about storage space, ask how many modules and functions were duplicated, and how many of those were loaded independently into RAM.
Bad programming in one area, means bad programming in all areas.
With your 1 MB example, I would ask if all of the devs who created all of the other programs on the system had written better and more efficient code, would you still need more RAM? The answer is no.
So many things wrong with this.
I am not a programmer by trade, and even though I learned programming in school, it’s not a thing I want to spend a lot of time doing, so I do use AI when I need to generate code.
But I have a few HARD rules.
I execute all code and commands. Nothing gets to run on my system without me.
Anything which can be even remotely destructive, must be flagged and not even shown to me, until I agree to the risk.
All information and commands must be verifiable by sourcing documentary links, or providing context links that I can peruse. If documentary evidence is not available, it must provide a rationale why I should execute what it generates.
Every command must be accompanied by a description of what the command will do, what each flag means, and what the expected outcome is.
I am the final authority on all matters. It is allowed to make suggestions, but never changes without my approval.
Without these constraints, I won’t trust it. Even then, I read all of the code it generates and verify it myself, so in the end, if it blows something up, I bear sole responsibility.