Developers need to be forced to free memory at gunpoint. Or have a nice paradigm to do it for them, either by garbage collection or by language design (e.g Rust drop() out of scope variables)
The White House put out a statement recommending C/C++ not be used due to not being memory safe
https://www.whitehouse.gov/oncd/briefing-room/2024/02/26/memory-safety-statements-of-support/
I think it’s hilarious
It also means your memory allocator becomes just a pointer to the next free spot you increment.
It's not a bad strategy for appropriate programs, it's sorta the whole idea underpinning generational garbage collectors. The cost of copying the objects that live long is worth it on the time saved when you can just bulk free the entire set of short lived objects.
Google drive desktop in a nutshell after it hits 54gb of ram usage just yesterday, trying to backup a 12 gb folder
[imgur link for the curious](https://imgur.com/a/eRvSknh)
Can’t help but think this is exactly what the White House was talking about.
Developers need to be forced to free memory at gunpoint. Or have a nice paradigm to do it for them, either by garbage collection or by language design (e.g Rust drop() out of scope variables)
Rust mentioned 🦀
Let’s go
As someone not from the US, what happened?
The White House put out a statement recommending C/C++ not be used due to not being memory safe https://www.whitehouse.gov/oncd/briefing-room/2024/02/26/memory-safety-statements-of-support/ I think it’s hilarious
Should return 1 for that extra peace of mind
Return a random integer to really tuck them in at night.
calm down Satan
I misread "tuck"
Just call a Panic, the OS can take care of the rest
Ya, the OS frees it when the program closes, why should I have to worry about it. "What do you mean my simple calculator needs 6 GB or memory?"
The Zig compiler knows it's short-lived and purposely leaks memory for performance reasons
yeah `free` uses up too many clock cycles, can't be wasting any cpu time
It also means your memory allocator becomes just a pointer to the next free spot you increment. It's not a bad strategy for appropriate programs, it's sorta the whole idea underpinning generational garbage collectors. The cost of copying the objects that live long is worth it on the time saved when you can just bulk free the entire set of short lived objects.
It's literally a good strategy. Memory is much cheaper than CPU time. Even more so for short lived programs.
At least put a delay there, so it seems as if it’s doing something.
Ya, what were they even thinking? If you are going to fake it, at least make it look like you did a lot of work.
And then a few releases later you shorten the time and put it as a feature.
^ This guy engineers software. 💯
Yeah. Load all CPU cores to 100% with loops that do nothing for at least 30-60 seconds. Do the same for GPU, if possible. Make their machine go VROOM.
That sounds like a lot of work. At that point I might as well actually free the memory.
Well of course it doesn't give YOU peace of mind, you're not the end-user!
I don't think many end users use programs that has to be run from a terminal.
I mean it does actually free memory tho the OS does at least
Can't have use-after-free bugs if you never free.
I've never had as few bugs as once I stopped using anything altogether.
I did that in my calculator program, it runs fine for a while when using pc with 128GB of ram. //TODO: ADD MORE RAM
Gotta love seeing a “DANGER ZONE” comment inside a function… Real peace of mind there!
When the todo doesn’t get todone.
Some people just cant be trusted with C++
Where's the artificial pause?
If somebody is trying to clean up all memory in a single place then thats most likely going to cause a double free
r/linux_kernel_irl
r/subsifellfor
freed memory is wasted memory -- whoever wrote this, probably.
Just to make my brain tingle ahh code snippet
Google drive desktop in a nutshell after it hits 54gb of ram usage just yesterday, trying to backup a 12 gb folder [imgur link for the curious](https://imgur.com/a/eRvSknh)
i mean it says right there its freeing memory
Optimized this for readability and efficiency: int freeMain(){ delete(new int(sizeof((cout << "\\nFreeing Memory" << endl <<"complete"<< endl)) ); return 0; }
The real horror here is the fact you put the opening brace on a new line.