Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

AndyTang

VS .NET and memory allocation

This topic is 5730 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post


Link to post
Share on other sites
Advertisement
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]

Share this post


Link to post
Share on other sites
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).

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
We're just guessing here, stack space might not be the problem at all. Is the line

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]

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!