Deallocation of memory

this line :
int main(){
node *head = new node((10) ;
}
allocates a space equal to the object size in heap memory.
So if we do not delete the head pointer at the end of main function will the space still be allocated in heap even if the whole program is terminated.

@nishchay-verma yes this will result in memory leak and you’ll be no longer able to access that memory but that space will still be occupied but unusable by any application

I have used node pointer around 20 times throughtout the linked list course, without deleting the node pointer so is there any way to delete that memory occupied in the heap, if not will that memory be automatically cleared when i switch off my laptop or something.
Please elabortate.

That memory should be cleared when you restart the laptop but otherwise you cannot do that on your own becausee you have no way of knowing where that data was stored

Thank you for clearing my doubt .

@nishchay-verma please mark your doubt as resolved

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.