Because its essential for application use where memory management becomes extremely vital, usually due to the rom or memory to be extremely linited in size. Worrying about memory management (something C++ makes mandatory) is something not all programmers need to care about, but having automated memory mangement is also what causes bloat that comes with modern applications, due to bad programming practices of not caring about it.
Is it mandatory in C++? I don’t do much with C++ regularly, but I was under the impression that destructors made it so that you wouldn’t have to manually release memory each time an object was destroyed. Or do you mean specifically regarding pointers to those objects needing to be released as well?
When you ever call new/malloc, its mandatory(dynamic allocation). For general programming, the size is usually decided at compilation.
Yes destructors will unallocate the memory, but the process of writing the destructor is part of the task of memory management
It becomes madness if you attempt to call dynamic memory outside of a class and its destructor, and hopefully the dev actually remembers to release said memory when their done.
You are not logged in. However you can subscribe from another Fediverse account, for example Lemmy or Mastodon. To do this, paste the following into the search field of your instance: !programmerhumor@lemmy.ml
Post funny things about programming here! (Or just rant about your favourite programming language.)
Rules:
Posts must be relevant to programming, programmers, or computer science.
No NSFW content.
Jokes must be in good taste. No hate speech, bigotry, etc.
Because its essential for application use where memory management becomes extremely vital, usually due to the rom or memory to be extremely linited in size. Worrying about memory management (something C++ makes mandatory) is something not all programmers need to care about, but having automated memory mangement is also what causes bloat that comes with modern applications, due to bad programming practices of not caring about it.
Only Garbage Collectors deal in absolutes
Is it mandatory in C++? I don’t do much with C++ regularly, but I was under the impression that destructors made it so that you wouldn’t have to manually release memory each time an object was destroyed. Or do you mean specifically regarding pointers to those objects needing to be released as well?
When you ever call new/malloc, its mandatory(dynamic allocation). For general programming, the size is usually decided at compilation.
Yes destructors will unallocate the memory, but the process of writing the destructor is part of the task of memory management
It becomes madness if you attempt to call dynamic memory outside of a class and its destructor, and hopefully the dev actually remembers to release said memory when their done.