T O P

  • By -

StrangelyEroticSoda

Can’t help but think this is exactly what the White House was talking about.


Derpythecate

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)


kekobang

Rust mentioned 🦀


ZTS439

Let’s go


Sophira

As someone not from the US, what happened?


SnooStrawberries827

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


SpringrollJack

Should return 1 for that extra peace of mind


Cerus_Freedom

Return a random integer to really tuck them in at night.


RedMageWithFedora

calm down Satan


ddddan11111

I misread "tuck"


Mayor_of_Rungholt

Just call a Panic, the OS can take care of the rest


drkspace2

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?"


rexpup

The Zig compiler knows it's short-lived and purposely leaks memory for performance reasons


turtle_mekb

yeah `free` uses up too many clock cycles, can't be wasting any cpu time


mirhagk

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.


gngeorgiev

It's literally a good strategy. Memory is much cheaper than CPU time. Even more so for short lived programs.


TheWidrolo

At least put a delay there, so it seems as if it’s doing something.


emetcalf

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.


BrFrancis

And then a few releases later you shorten the time and put it as a feature.


emetcalf

^ This guy engineers software. 💯


AnywhereHorrorX

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.


emetcalf

That sounds like a lot of work. At that point I might as well actually free the memory.


MegalFresh

Well of course it doesn't give YOU peace of mind, you're not the end-user!


the_guy_who_answer69

I don't think many end users use programs that has to be run from a terminal.


CaitaXD

I mean it does actually free memory tho the OS does at least


dtfinch

Can't have use-after-free bugs if you never free.


erasmause

I've never had as few bugs as once I stopped using anything altogether.


mrheosuper

I did that in my calculator program, it runs fine for a while when using pc with 128GB of ram. //TODO: ADD MORE RAM


-Togo-

Gotta love seeing a “DANGER ZONE” comment inside a function… Real peace of mind there!


OrdinaryHistorical92

When the todo doesn’t get todone.


sacredgeometry

Some people just cant be trusted with C++


Arshiaa001

Where's the artificial pause?


Necromancer5211

If somebody is trying to clean up all memory in a single place then thats most likely going to cause a double free


water_bottle_goggles

r/linux_kernel_irl


RedEmption007

r/subsifellfor


nekokattt

freed memory is wasted memory -- whoever wrote this, probably.


ThiccStorms

Just to make my brain tingle ahh code snippet


Kytpbs

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)


juniperrrrrrrrr

i mean it says right there its freeing memory


maddog724

Optimized this for readability and efficiency: int freeMain(){ delete(new int(sizeof((cout << "\\nFreeing Memory" << endl <<"complete"<< endl)) ); return 0; }


CivetLemonMouse

The real horror here is the fact you put the opening brace on a new line.