VS .NET and memory allocation
Im having a major problem with my application, it keeps crashing. I am trying to create a Transposition Table for AI search algorithm, unfortunetly everytime I try to initialise the Transposition Table class, it crashes.
There is only one thing inside it and a few methods. The main thing is it has the class member:
CTranspositionEntry m_entry[131072];
this is causing the crash, if I set it to an array of 10 or 20, its fine but anything that high just causes the application to crash. Just to be clear, it crashes on the line:
CTranspositionTable m_table;
I also have nothing in the constructor. Any help or suggestions?
is that stuff being put on stack? if yes, use dynamic memory instead (std::vector).
edit: for future reference: include in your post exactly how it crashed. saying things like "stack overflow exception" allows us to pinpoint the problem easily.
[edited by - niyaw on December 7, 2002 9:44:46 PM]
edit: for future reference: include in your post exactly how it crashed. saying things like "stack overflow exception" allows us to pinpoint the problem easily.
[edited by - niyaw on December 7, 2002 9:44:46 PM]
Is m_table a global/static or local object? If it''s a local object, you may be running out of stack space (limited to 1 megabyte by default).
I see, sorry dont know much about stack spaces so it could be it. I cant use dynamic memory because its a hash table and so the array much be created from the start.
Sorry about the error, it doesnt really say - General Protection Fault in Windows (even in Debug mode). I dont think you want the bunch of numbers.
Does this limit (1MB stack space) apply to previous Visual Studio too cause I remember it seemed to worked well in VS6. Anyway to get pass this limit cause I need to arrays of 131072 in a class as a class member.
[edited by - Chrominium on December 7, 2002 9:57:22 PM]
Sorry about the error, it doesnt really say - General Protection Fault in Windows (even in Debug mode). I dont think you want the bunch of numbers.
Does this limit (1MB stack space) apply to previous Visual Studio too cause I remember it seemed to worked well in VS6. Anyway to get pass this limit cause I need to arrays of 131072 in a class as a class member.
[edited by - Chrominium on December 7, 2002 9:57:22 PM]
We're just guessing here, stack space might not be the problem at all. Is the line
BTW, using dynamic allocation shouldn't be a problem even if the array is needed "from the start". Just make sure it's allocated before you use it. std::vector sounds like a good idea for this.
[edited by - spock on December 7, 2002 11:10:46 PM]
CTranspositionTable m_table;
inside a function? Because if it's not, then it's definitely not a problem with running out of stack space.BTW, using dynamic allocation shouldn't be a problem even if the array is needed "from the start". Just make sure it's allocated before you use it. std::vector sounds like a good idea for this.
[edited by - spock on December 7, 2002 11:10:46 PM]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement