C++ WINAPI Exception Unhandled Stack Overflow before reaching codeHow can I profile C++ code running on Linux?C++ code file extension? .cc vs .cppC# catch a stack overflow exceptionc++ stack overflow unhandled exception with large arrayCan code that is valid in both C and C++ produce different behavior when compiled in each language?Stack overflow exception before main()Use ndk-build to link with an existing static libraryWhat actually causes a Stack Overflow error?Function works when not in namespace else it breaksC++ code for testing the Collatz conjecture faster than hand-written assembly - why?
What's the most polite way to tell a manager "shut up and let me work"?
What is the indigenous Russian word for a wild boar?
Modern approach to radio buttons
Tic-Tac-Toe for the terminal
Thousands and thousands of words
Do creatures all have the same statistics upon being reanimated via the Animate Dead spell?
The qvolume of an integer
Can a rogue effectively triple their speed by combining Dash and Ready?
What is game ban VS VAC ban in steam?
Preserving culinary oils
If a problem only occurs randomly once in every N times on average, how many tests do I have to perform to be certain that it's now fixed?
How was Apollo supposed to rendezvous in the case of a lunar abort?
How can I offer a test ride while selling a bike?
Can an old DSLR be upgraded to match modern smartphone image quality
Is this light switch installation safe and legal?
Asking bank to reduce APR instead of increasing credit limit
Could I be denied entry into Ireland due to medical and police situations during a previous UK visit?
What are the benefits of cryosleep?
What caused the tendency for conservatives to not support climate change regulations?
Creating Fictional Slavic Place Names
What was this black-and-white film set in the Arctic or Antarctic where the monster/alien gets fried in the end?
Intuition behind eigenvalues of an adjacency matrix
Infinitely many hats
Draw a checker pattern with a black X in the center
C++ WINAPI Exception Unhandled Stack Overflow before reaching code
How can I profile C++ code running on Linux?C++ code file extension? .cc vs .cppC# catch a stack overflow exceptionc++ stack overflow unhandled exception with large arrayCan code that is valid in both C and C++ produce different behavior when compiled in each language?Stack overflow exception before main()Use ndk-build to link with an existing static libraryWhat actually causes a Stack Overflow error?Function works when not in namespace else it breaksC++ code for testing the Collatz conjecture faster than hand-written assembly - why?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I've put together a nice little terrain engine in direct x. I changed the width
and height
of the land from 256
to 512
and now when I run the debugger the program crashes in wWinMain
. The Width
and Height
are const static unsigned int
I should add that if I change the numbers back to 256 the program debugs fine without error. Only when changing these numbers does it throw a stack-overflow error.
Unhandled exception at 0x00007FF7065C9FB8 in TerrainEngine.exe: 0xC00000FD: Stack overflow (parameters: 0x0000000000000001, 0x00000022AA803000).
class Constants
{
public:
// World rows and columns
const static unsigned int WorldWidth = 256; //changing this to a number greater than
const static unsigned int WorldHeight = 256; //256 causes stack overflow
When changing WorldWidth or WorldHeight to a number greater than 256 I get a stack overflow error at the very beginning of my code, so early that I'm unable to properly debug further to see what's going wrong.
void World::Initialize(Graphics & graphics)
this->graphics = &graphics;
....
// Setup Perlin Noise
PerlinNoise perlinNoise = PerlinNoise(237);
for (unsigned int y = 0; y < Constants::WorldHeight; y++)
for (unsigned int x = 0; x < Constants::WorldWidth; x++)
double xx = (double)x / ((double)Constants::WorldWidth);
double yy = (double)y / ((double)Constants::WorldHeight);
//define in header as std::array<std::array<float, Constants::WorldWidth>, Constants::WorldHeight> heightmap;
heightmap[x][y] = perlinNoise.noise(xx, yy, 1);
tileManager.SetTile(x, y, Math::GetType(heightmap[x][y]));
void World::Update(Keyboard& keyboard)
{
// The only other time WorldWidth is referenced
//posX is public signed int
posX = Math::Clamp(
posX,
Constants::WorldWidth - Constants::RenderWidth,
Constants::RenderWidth);
Can anyone explain what's happening, cause I'm unable to debug past the first curly brace which leads to the wWinMain method, and I don't understand how changing these two values can cause the program to throw this error.
World is declared as raw, ordinary private member in the Game header file.
World world;
It has one constructor that is empty.
c++ winapi memory directx stack-overflow
|
show 8 more comments
I've put together a nice little terrain engine in direct x. I changed the width
and height
of the land from 256
to 512
and now when I run the debugger the program crashes in wWinMain
. The Width
and Height
are const static unsigned int
I should add that if I change the numbers back to 256 the program debugs fine without error. Only when changing these numbers does it throw a stack-overflow error.
Unhandled exception at 0x00007FF7065C9FB8 in TerrainEngine.exe: 0xC00000FD: Stack overflow (parameters: 0x0000000000000001, 0x00000022AA803000).
class Constants
{
public:
// World rows and columns
const static unsigned int WorldWidth = 256; //changing this to a number greater than
const static unsigned int WorldHeight = 256; //256 causes stack overflow
When changing WorldWidth or WorldHeight to a number greater than 256 I get a stack overflow error at the very beginning of my code, so early that I'm unable to properly debug further to see what's going wrong.
void World::Initialize(Graphics & graphics)
this->graphics = &graphics;
....
// Setup Perlin Noise
PerlinNoise perlinNoise = PerlinNoise(237);
for (unsigned int y = 0; y < Constants::WorldHeight; y++)
for (unsigned int x = 0; x < Constants::WorldWidth; x++)
double xx = (double)x / ((double)Constants::WorldWidth);
double yy = (double)y / ((double)Constants::WorldHeight);
//define in header as std::array<std::array<float, Constants::WorldWidth>, Constants::WorldHeight> heightmap;
heightmap[x][y] = perlinNoise.noise(xx, yy, 1);
tileManager.SetTile(x, y, Math::GetType(heightmap[x][y]));
void World::Update(Keyboard& keyboard)
{
// The only other time WorldWidth is referenced
//posX is public signed int
posX = Math::Clamp(
posX,
Constants::WorldWidth - Constants::RenderWidth,
Constants::RenderWidth);
Can anyone explain what's happening, cause I'm unable to debug past the first curly brace which leads to the wWinMain method, and I don't understand how changing these two values can cause the program to throw this error.
World is declared as raw, ordinary private member in the Game header file.
World world;
It has one constructor that is empty.
c++ winapi memory directx stack-overflow
1
Please show a minimal reproducible example
– David Heffernan
Mar 19 at 15:45
I'm unable to debug it while the values are greater than 256 else the compiler doesn't get that far. Else nothing seems out of the ordinary. I know the constructor that takes the width and height and uses them to declare a pointer-to-pointer array.
– Anthony
Mar 19 at 15:58
Doesstd::cout << sizeof( MainWindow ) << sizeof( Game ) << "n";
tell you anything? If it doesn't run as-is, you can comment out the twotry
blocks.
– Tim Randall
Mar 19 at 16:04
What's the stack trace when you get the failure? Probably you have infinite recursion in a global variable initialization.
– Ben Voigt
Mar 19 at 16:07
1
Show the code whereWorld
instance is created. If you created it onto stack you have problem, stack's size is limited, default value on windows is 1MB, so512*512*sizeof(float)
gives you 1 MB. Hence stack overflow. CreateWorld
onto heap, bynew
.
– rafix07
Mar 19 at 21:09
|
show 8 more comments
I've put together a nice little terrain engine in direct x. I changed the width
and height
of the land from 256
to 512
and now when I run the debugger the program crashes in wWinMain
. The Width
and Height
are const static unsigned int
I should add that if I change the numbers back to 256 the program debugs fine without error. Only when changing these numbers does it throw a stack-overflow error.
Unhandled exception at 0x00007FF7065C9FB8 in TerrainEngine.exe: 0xC00000FD: Stack overflow (parameters: 0x0000000000000001, 0x00000022AA803000).
class Constants
{
public:
// World rows and columns
const static unsigned int WorldWidth = 256; //changing this to a number greater than
const static unsigned int WorldHeight = 256; //256 causes stack overflow
When changing WorldWidth or WorldHeight to a number greater than 256 I get a stack overflow error at the very beginning of my code, so early that I'm unable to properly debug further to see what's going wrong.
void World::Initialize(Graphics & graphics)
this->graphics = &graphics;
....
// Setup Perlin Noise
PerlinNoise perlinNoise = PerlinNoise(237);
for (unsigned int y = 0; y < Constants::WorldHeight; y++)
for (unsigned int x = 0; x < Constants::WorldWidth; x++)
double xx = (double)x / ((double)Constants::WorldWidth);
double yy = (double)y / ((double)Constants::WorldHeight);
//define in header as std::array<std::array<float, Constants::WorldWidth>, Constants::WorldHeight> heightmap;
heightmap[x][y] = perlinNoise.noise(xx, yy, 1);
tileManager.SetTile(x, y, Math::GetType(heightmap[x][y]));
void World::Update(Keyboard& keyboard)
{
// The only other time WorldWidth is referenced
//posX is public signed int
posX = Math::Clamp(
posX,
Constants::WorldWidth - Constants::RenderWidth,
Constants::RenderWidth);
Can anyone explain what's happening, cause I'm unable to debug past the first curly brace which leads to the wWinMain method, and I don't understand how changing these two values can cause the program to throw this error.
World is declared as raw, ordinary private member in the Game header file.
World world;
It has one constructor that is empty.
c++ winapi memory directx stack-overflow
I've put together a nice little terrain engine in direct x. I changed the width
and height
of the land from 256
to 512
and now when I run the debugger the program crashes in wWinMain
. The Width
and Height
are const static unsigned int
I should add that if I change the numbers back to 256 the program debugs fine without error. Only when changing these numbers does it throw a stack-overflow error.
Unhandled exception at 0x00007FF7065C9FB8 in TerrainEngine.exe: 0xC00000FD: Stack overflow (parameters: 0x0000000000000001, 0x00000022AA803000).
class Constants
{
public:
// World rows and columns
const static unsigned int WorldWidth = 256; //changing this to a number greater than
const static unsigned int WorldHeight = 256; //256 causes stack overflow
When changing WorldWidth or WorldHeight to a number greater than 256 I get a stack overflow error at the very beginning of my code, so early that I'm unable to properly debug further to see what's going wrong.
void World::Initialize(Graphics & graphics)
this->graphics = &graphics;
....
// Setup Perlin Noise
PerlinNoise perlinNoise = PerlinNoise(237);
for (unsigned int y = 0; y < Constants::WorldHeight; y++)
for (unsigned int x = 0; x < Constants::WorldWidth; x++)
double xx = (double)x / ((double)Constants::WorldWidth);
double yy = (double)y / ((double)Constants::WorldHeight);
//define in header as std::array<std::array<float, Constants::WorldWidth>, Constants::WorldHeight> heightmap;
heightmap[x][y] = perlinNoise.noise(xx, yy, 1);
tileManager.SetTile(x, y, Math::GetType(heightmap[x][y]));
void World::Update(Keyboard& keyboard)
{
// The only other time WorldWidth is referenced
//posX is public signed int
posX = Math::Clamp(
posX,
Constants::WorldWidth - Constants::RenderWidth,
Constants::RenderWidth);
Can anyone explain what's happening, cause I'm unable to debug past the first curly brace which leads to the wWinMain method, and I don't understand how changing these two values can cause the program to throw this error.
World is declared as raw, ordinary private member in the Game header file.
World world;
It has one constructor that is empty.
c++ winapi memory directx stack-overflow
c++ winapi memory directx stack-overflow
edited Mar 24 at 9:56
marc_s
591k13311301278
591k13311301278
asked Mar 19 at 15:39
AnthonyAnthony
90111
90111
1
Please show a minimal reproducible example
– David Heffernan
Mar 19 at 15:45
I'm unable to debug it while the values are greater than 256 else the compiler doesn't get that far. Else nothing seems out of the ordinary. I know the constructor that takes the width and height and uses them to declare a pointer-to-pointer array.
– Anthony
Mar 19 at 15:58
Doesstd::cout << sizeof( MainWindow ) << sizeof( Game ) << "n";
tell you anything? If it doesn't run as-is, you can comment out the twotry
blocks.
– Tim Randall
Mar 19 at 16:04
What's the stack trace when you get the failure? Probably you have infinite recursion in a global variable initialization.
– Ben Voigt
Mar 19 at 16:07
1
Show the code whereWorld
instance is created. If you created it onto stack you have problem, stack's size is limited, default value on windows is 1MB, so512*512*sizeof(float)
gives you 1 MB. Hence stack overflow. CreateWorld
onto heap, bynew
.
– rafix07
Mar 19 at 21:09
|
show 8 more comments
1
Please show a minimal reproducible example
– David Heffernan
Mar 19 at 15:45
I'm unable to debug it while the values are greater than 256 else the compiler doesn't get that far. Else nothing seems out of the ordinary. I know the constructor that takes the width and height and uses them to declare a pointer-to-pointer array.
– Anthony
Mar 19 at 15:58
Doesstd::cout << sizeof( MainWindow ) << sizeof( Game ) << "n";
tell you anything? If it doesn't run as-is, you can comment out the twotry
blocks.
– Tim Randall
Mar 19 at 16:04
What's the stack trace when you get the failure? Probably you have infinite recursion in a global variable initialization.
– Ben Voigt
Mar 19 at 16:07
1
Show the code whereWorld
instance is created. If you created it onto stack you have problem, stack's size is limited, default value on windows is 1MB, so512*512*sizeof(float)
gives you 1 MB. Hence stack overflow. CreateWorld
onto heap, bynew
.
– rafix07
Mar 19 at 21:09
1
1
Please show a minimal reproducible example
– David Heffernan
Mar 19 at 15:45
Please show a minimal reproducible example
– David Heffernan
Mar 19 at 15:45
I'm unable to debug it while the values are greater than 256 else the compiler doesn't get that far. Else nothing seems out of the ordinary. I know the constructor that takes the width and height and uses them to declare a pointer-to-pointer array.
– Anthony
Mar 19 at 15:58
I'm unable to debug it while the values are greater than 256 else the compiler doesn't get that far. Else nothing seems out of the ordinary. I know the constructor that takes the width and height and uses them to declare a pointer-to-pointer array.
– Anthony
Mar 19 at 15:58
Does
std::cout << sizeof( MainWindow ) << sizeof( Game ) << "n";
tell you anything? If it doesn't run as-is, you can comment out the two try
blocks.– Tim Randall
Mar 19 at 16:04
Does
std::cout << sizeof( MainWindow ) << sizeof( Game ) << "n";
tell you anything? If it doesn't run as-is, you can comment out the two try
blocks.– Tim Randall
Mar 19 at 16:04
What's the stack trace when you get the failure? Probably you have infinite recursion in a global variable initialization.
– Ben Voigt
Mar 19 at 16:07
What's the stack trace when you get the failure? Probably you have infinite recursion in a global variable initialization.
– Ben Voigt
Mar 19 at 16:07
1
1
Show the code where
World
instance is created. If you created it onto stack you have problem, stack's size is limited, default value on windows is 1MB, so 512*512*sizeof(float)
gives you 1 MB. Hence stack overflow. Create World
onto heap, by new
.– rafix07
Mar 19 at 21:09
Show the code where
World
instance is created. If you created it onto stack you have problem, stack's size is limited, default value on windows is 1MB, so 512*512*sizeof(float)
gives you 1 MB. Hence stack overflow. Create World
onto heap, by new
.– rafix07
Mar 19 at 21:09
|
show 8 more comments
1 Answer
1
active
oldest
votes
You have a very large array which presently is part of a variable with automatic lifetime that the compiler places on the stack. Since it's too big to fit, you get a stack overflow.
Replace your array declared as
double heightmap[Constants::WorldWidth][Constants::WorldHeight];
by
std::unique_ptr<double [][Constants::WorldHeight]> heightmapstd::make_unique<double [][Constants::WorldHeight]>(Constants::WorldWidth);
You will also have to #include <memory>
if you haven't already.
Nothing else needs to change1. make_unique
will allocate the storage for the same exact contiguous 2-D array you had before, only it will be dynamically allocated instead of taking up stack space. And unique_ptr
is smart enough to automatically free the storage when the class instance that owns it goes away.
1 Only probably true. std::unique_ptr<Type[]>
supports subscripting with []
, so your current code heightmap[x][y]
will continue working. If you used array-to-pointer decay anywhere without subscripting, you will now need heightmap.get()
or &heightmap[0][0]
instead of just the bare array name.
Thanks Ben for all your help
– Anthony
Mar 19 at 22:12
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55244802%2fc-winapi-exception-unhandled-stack-overflow-before-reaching-code%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You have a very large array which presently is part of a variable with automatic lifetime that the compiler places on the stack. Since it's too big to fit, you get a stack overflow.
Replace your array declared as
double heightmap[Constants::WorldWidth][Constants::WorldHeight];
by
std::unique_ptr<double [][Constants::WorldHeight]> heightmapstd::make_unique<double [][Constants::WorldHeight]>(Constants::WorldWidth);
You will also have to #include <memory>
if you haven't already.
Nothing else needs to change1. make_unique
will allocate the storage for the same exact contiguous 2-D array you had before, only it will be dynamically allocated instead of taking up stack space. And unique_ptr
is smart enough to automatically free the storage when the class instance that owns it goes away.
1 Only probably true. std::unique_ptr<Type[]>
supports subscripting with []
, so your current code heightmap[x][y]
will continue working. If you used array-to-pointer decay anywhere without subscripting, you will now need heightmap.get()
or &heightmap[0][0]
instead of just the bare array name.
Thanks Ben for all your help
– Anthony
Mar 19 at 22:12
add a comment |
You have a very large array which presently is part of a variable with automatic lifetime that the compiler places on the stack. Since it's too big to fit, you get a stack overflow.
Replace your array declared as
double heightmap[Constants::WorldWidth][Constants::WorldHeight];
by
std::unique_ptr<double [][Constants::WorldHeight]> heightmapstd::make_unique<double [][Constants::WorldHeight]>(Constants::WorldWidth);
You will also have to #include <memory>
if you haven't already.
Nothing else needs to change1. make_unique
will allocate the storage for the same exact contiguous 2-D array you had before, only it will be dynamically allocated instead of taking up stack space. And unique_ptr
is smart enough to automatically free the storage when the class instance that owns it goes away.
1 Only probably true. std::unique_ptr<Type[]>
supports subscripting with []
, so your current code heightmap[x][y]
will continue working. If you used array-to-pointer decay anywhere without subscripting, you will now need heightmap.get()
or &heightmap[0][0]
instead of just the bare array name.
Thanks Ben for all your help
– Anthony
Mar 19 at 22:12
add a comment |
You have a very large array which presently is part of a variable with automatic lifetime that the compiler places on the stack. Since it's too big to fit, you get a stack overflow.
Replace your array declared as
double heightmap[Constants::WorldWidth][Constants::WorldHeight];
by
std::unique_ptr<double [][Constants::WorldHeight]> heightmapstd::make_unique<double [][Constants::WorldHeight]>(Constants::WorldWidth);
You will also have to #include <memory>
if you haven't already.
Nothing else needs to change1. make_unique
will allocate the storage for the same exact contiguous 2-D array you had before, only it will be dynamically allocated instead of taking up stack space. And unique_ptr
is smart enough to automatically free the storage when the class instance that owns it goes away.
1 Only probably true. std::unique_ptr<Type[]>
supports subscripting with []
, so your current code heightmap[x][y]
will continue working. If you used array-to-pointer decay anywhere without subscripting, you will now need heightmap.get()
or &heightmap[0][0]
instead of just the bare array name.
You have a very large array which presently is part of a variable with automatic lifetime that the compiler places on the stack. Since it's too big to fit, you get a stack overflow.
Replace your array declared as
double heightmap[Constants::WorldWidth][Constants::WorldHeight];
by
std::unique_ptr<double [][Constants::WorldHeight]> heightmapstd::make_unique<double [][Constants::WorldHeight]>(Constants::WorldWidth);
You will also have to #include <memory>
if you haven't already.
Nothing else needs to change1. make_unique
will allocate the storage for the same exact contiguous 2-D array you had before, only it will be dynamically allocated instead of taking up stack space. And unique_ptr
is smart enough to automatically free the storage when the class instance that owns it goes away.
1 Only probably true. std::unique_ptr<Type[]>
supports subscripting with []
, so your current code heightmap[x][y]
will continue working. If you used array-to-pointer decay anywhere without subscripting, you will now need heightmap.get()
or &heightmap[0][0]
instead of just the bare array name.
edited Mar 19 at 21:58
answered Mar 19 at 21:49
Ben VoigtBen Voigt
239k30320590
239k30320590
Thanks Ben for all your help
– Anthony
Mar 19 at 22:12
add a comment |
Thanks Ben for all your help
– Anthony
Mar 19 at 22:12
Thanks Ben for all your help
– Anthony
Mar 19 at 22:12
Thanks Ben for all your help
– Anthony
Mar 19 at 22:12
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55244802%2fc-winapi-exception-unhandled-stack-overflow-before-reaching-code%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
Please show a minimal reproducible example
– David Heffernan
Mar 19 at 15:45
I'm unable to debug it while the values are greater than 256 else the compiler doesn't get that far. Else nothing seems out of the ordinary. I know the constructor that takes the width and height and uses them to declare a pointer-to-pointer array.
– Anthony
Mar 19 at 15:58
Does
std::cout << sizeof( MainWindow ) << sizeof( Game ) << "n";
tell you anything? If it doesn't run as-is, you can comment out the twotry
blocks.– Tim Randall
Mar 19 at 16:04
What's the stack trace when you get the failure? Probably you have infinite recursion in a global variable initialization.
– Ben Voigt
Mar 19 at 16:07
1
Show the code where
World
instance is created. If you created it onto stack you have problem, stack's size is limited, default value on windows is 1MB, so512*512*sizeof(float)
gives you 1 MB. Hence stack overflow. CreateWorld
onto heap, bynew
.– rafix07
Mar 19 at 21:09