What is the use of " delete " expression in real time program running ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What is the use of " delete " expression in real time program running ?

In c++ programming I learnt about delete expression but I couldn't get much about that it says that it releases memory . Please give me real time example about software when any software uses the delete command ?😕

12th Sep 2018, 6:02 AM
Atik🇧🇩
Atik🇧🇩 - avatar
4 Answers
+ 1
That's correct, usually all will be in ram. Yes in a similar way - if we retained every image we rendered we would quickly run out of memory to make new ones. If the image (or object) is no longer used its memory should be released to make way for new objects
12th Sep 2018, 6:21 AM
Dan Walker
Dan Walker - avatar
+ 1
Every piece of software. Whenever you allocate memory you're going to want to release it, otherwise you'll keep using more and more and then the program will crash. One of the tricky parts of programming with C++ is determining the useful lifetime of an object so that you can delete it. Improper memory management can cause 'memory leaks' and impair the performance of the program and ultimately crash it
12th Sep 2018, 6:11 AM
Dan Walker
Dan Walker - avatar
0
is this the ram memory Dan Walker
12th Sep 2018, 6:14 AM
Atik🇧🇩
Atik🇧🇩 - avatar
0
when I run any software . Think I am running a game in my pc we know everytime graphic changes so here the memory dynamically allocates memory after a new graphic loads the old must be deleted to load new graphic . similar analogy to yours am I right Dan Walker ? And is the heap memory is the ram memory or the unused program memory which needs to be used while running a app ?
12th Sep 2018, 6:19 AM
Atik🇧🇩
Atik🇧🇩 - avatar