weirdest memory problem ever

Started by
15 comments, last by CProgrammer 20 years, 2 months ago
Im going nuts here. I have an app that works great with small values as input but crashes with larger ones. When however I add a textbox command somewhere in the algorithm it always crashes no matter where I add the textbox. Its like the program is so unstable it cant handle the textbox. Geeze what kind of problem could this be. -CProgrammer
Advertisement
I am sorry, but I think it is impossible to tell without an you posting the code.
Array bounds overrun.
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan
quote:Original post by Fruny
Array bounds overrun.


Is it possible that Array bounds have been overrun, the app doesnt crash but then crashes upon calling MessageBox?

-CProgrammer
quote:Original post by CProgrammer

Is it possible that Array bounds have been overrun, the app doesnt crash but then crashes upon calling MessageBox?

-CProgrammer


Yes, it is, because you may have trampled on some important memory related to it when you overran the array.

-Mezz
I c thanks, looks like I''ll just have to go through all iterations again.
-CProgrammer
Oh and could such an effect be caused by using delete instead of delete[]
quote:Original post by CProgrammer
Oh and could such an effect be caused by using delete instead of delete[]


depends on whether you should be using delete[] instead of delete
Hi! CProgrammer

I think I can help you.

You can''t allocate more memory than the stupid Windows XP Allocated Memory Limit.
So if the Total Allocated memory is 182504 kB and your Limit is 206108 kB you can''t alloate a memoryblock that is bigger than 206108-182504 = 23604 kb.
You can solve this like I did, set the minimum virtual memory limit to 4096 MB and maximum to 4096 MB. But the bad is that the game may not work on other computer.
Or you can try allocate many small memory blocks, that will increase the memory Limit, until you have allocated equal the amount memory you need. Then free it and allocate the big memoryblock. But I haven''t tried this.

I hope this helps you.

- DataWigge
datawigge: Thanks, I think you just helped me majorly.
Actually my programm uses a lot of memory. Furthermore it crashes when a recursive function is executed for large numbers, so it calls itself more often and saves a larger single array. If what your saying is true I can search until I day and not find anything, phew. What solution is there. By the way I have 1GB ram but if windows limits than that doesnt matter. Is there a limit to the size of an array and can my app somehow tell windows that I need more memory.
Thanks for any advice on how to solve this.
-CProgrammer

This topic is closed to new replies.

Advertisement