Skip to main content
gamedev.net
🔒 Locked

c++ problem...

Started by JaZsT Oct 8, 2001 at 2:04 PM 7 replies 300+ views
Original Post
JaZsT
JaZsT
Hello !!! I have an interesting problem in MS visual c++. In a class Unit, I have six twodimensional arrays of ints like this: int Array1[40][80]; . . . int Array6[40][80]; So far so good. Today I added another array... int Array7[50][50]; ...and when I executed the program it crashed !!!!(((( Yes, that''s right, the only difference i made was that array, and the program that previously worked perfectly now crashes at startup (( What could possibly be the problem ????? A kind of lack of memory....??...I dont think so... Thanx in advance -- Uros Life lived unexplored is life not worth living !
Life lived unexplored is life not worth living !
Prosper/LOADED
Prosper/LOADED
How many global instances of your class do you have ? If you have too many of them the executable data segment may be too big and the program may crash at startup. You could try to dynamicaly allocate your objects and/or your arrays.
SPAR
SPAR
The only way we can answer this is to see the source code.
GoofProg
GoofProg
It should not be a problem. You should be able to declare an array as big as you want.. as long as you have enough memory for it. Using a pointer and using ''new'' or ''malloc'' is a fancy of doing the same thing... as far as what I read from this post.
Ask yourself some questions..

Am I accessing the data from the allocated range?
Did I use the functions correctly?
Did I use an array where a pointer should have been?

Debug your program by using some MessageBox functions

Here I''m in function foo(..)

Now in function foo2(..)

....
and you''ll track it down

happy bug hunting =)

The nightmare travels across the cosmos with his burning mane.  The trail of ash that is produced. ?Have a nice day!?
savagerx
savagerx
I''m not really a professional but still learning C++ and according to my experience with C++(Borland), the problem may be due to the existing .ils and .obj files. Maybe you can try deleting those files but not your source code(.cpp)
It is only a comment, take it as a reference....
I welcome any comments.

The road may be long, wind may be rough. But with a will at heart, all shall begone. ~savage chant
The road may be long, wind may be rough. But with a will at heart, all shall begone. ~savage chant
python_regious
python_regious
Anon poster is right, programs are allocated a fixed amount of space on the stack, you could be overrunning that. Use new/delete instead.
If at first you don't succeed, redefine success.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.