72
Bjarne Stroustrup: How do I deal with memory leaks? By writing code that doesn't have any.
(www.stroustrup.com)
Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!
Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.
Hope you enjoy the instance!
Rules
Follow the wormhole through a path of communities !webdev@programming.dev
To be clear, he's not saying "just code better", as the title implies. It's a really poor choice of title.
He goes on to say, effectively, "Don't use new/delete/malloc/free if you can help it. Use smarter mechanisms."
Ya, I don’t think he actually said that since it’s not mentioned in the referenced article. What’s actually meant is “by writing code that doesn’t have any memory management”.
C++'s so called smarter mechanisms are ugly af. I would rather my RAM crash and burn than use its standard library.
yeah. I'd rather use C and statically allocate everything up front, even if that's not a great fit
When I did embedded programming that's what I did. Nothing was dynamically allocated. It also allowed me to write a debugger that would watch how variables changed by just directly reading from memory, chart them, and and stuff like that.