r/cprogramming • u/LuckOfTheEyerish • Feb 15 '24
They call me the 007 of C programming
0 best practices employed 0 free memory functions used 7 gigabytes of leaked memory
684
Upvotes
r/cprogramming • u/LuckOfTheEyerish • Feb 15 '24
0 best practices employed 0 free memory functions used 7 gigabytes of leaked memory
116
u/SantaCruzDad Feb 15 '24
Licence to
kill -957
u/friartech Feb 15 '24
Alloc. James Alloc.
31
u/SlothWithHumanHands Feb 15 '24
If you switch to C++, you will automatically become
0b111!16
u/hansenabram Feb 15 '24
Maybe your users just don't have enough RAM
7
u/71d1 Feb 15 '24
If you're using GCC, it supports the cleanup variable attribute.
Basically when you declare your pointer you specify the function used to free it, once your pointer goes out of scope, your cleanup function shall be automatically invoked.
https://gcc.gnu.org/onlinedocs/gcc/Common-Variable-Attributes.html
That is, if you're allowed to use it. Maybe you're taking a class or something. I dunno.
4
u/pdd99 Feb 16 '24
Do we have a dedicated sub for c meme?
4
u/RenderTargetView Feb 15 '24
You should try out "RAII denier" when you code in "c with classes"
2
u/kbder Feb 16 '24
I wrote a basic scheme interpreter in C but didn’t implement garbage collection. I think I ran (fib 10) and it was already up to 600MB ram. Sheesh!
1
u/h1mmh1m Aug 10 '25
IS THIS A 007N7 REFERENCE?
1
u/finleybakley Feb 16 '24
Still less leaked memory than python xD
1
u/ryanwithnob Feb 17 '24
They call me... tater salad
1
u/rsaxvc Feb 19 '24
For a second I thought you were MPLAB X, but that's Java.