I was looking through some open source application and I noticed that the main.cpp
file look something like this
...
int main()
{
Application *app = new Application;
delete app;
return 0;
}
basically the application object which represent the whole logic of the actual application is allocated on the heap, but the problem is that inside some other files that are a part of the application like Window.h or event.h to name some, there is some heap allocation going on, for example the event.h stores events in a Queue using new pointers...
and my question is: if the whole application is running on the heap, what is the point of heap allocations, does it make any difference ?
and why do a lot of applications and mostly games do this move (allocating the main "entry object" on the heap) ?
thanks!