What exactly happens when you new() an object

6 min readDec 26, 2023

All you need to know about memory

The story

“Today I was asked about what happens when new() an object during the interview.” my friend said.

“Ok looks like a basic question, how did you answer,” I said.

“Yes, basic but not easy to answer”. he said.

“I talked about heap, object lifecycle, GC, reference counting,” he said.

“Well that should be good enough for a junior position. You do not have to mention virtual memory…




A channel which focusing on developer growth and self improvement