The MyApp object with the line uncommented is pretty big. When your program tries to create it on the stack, it may cause a stack overflow. You should generally avoid to allocate objects with this magnitude of size on the stack as stack is more limited than the heap.