Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where is dynamic memory allocated?

The question was asked to me in an interview and my answer was "computer memory". But where exactly..? is it the Random Access Memory or the hard drive?

like image 338
Vaibhav Avatar asked Dec 04 '22 11:12

Vaibhav


1 Answers

They were probably looking for "the heap". This is an area of memory that's separate from "the stack", which is where all your local variables, parameters, return values, etc., are stored. And yes, it's all in RAM, not on the hard drive.

like image 95
jwismar Avatar answered Dec 23 '22 18:12

jwismar



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!