in c++ how is memory allocated on the heap