IonicWind Software

IWBasic => General Questions => Topic started by: JoaoAfonso on June 16, 2008, 01:29:15 PM

Title: First chance exception: Address 0x0044295D Access Violation
Post by: JoaoAfonso on June 16, 2008, 01:29:15 PM
I am getting crazy. A program that used to run ok as supposed, suddenly started giving this error in debug mode. I know I made some small changes, but even fixing it, still gives this error.
When not in debug mode, the program closes itself without being supposed to, and also without any other error message. Is this something obvious?
Title: Re: First chance exception: Address 0x0044295D Access Violation
Post by: Ionic Wind Support Team on June 16, 2008, 01:42:57 PM
Two controls with the same ID will do it.
Title: Re: First chance exception: Address 0x0044295D Access Violation
Post by: JoaoAfonso on June 16, 2008, 02:01:33 PM
I've remembered sometime ago something that did the same. The solution was increasing stack size and stack commit size. Did it now and worked...

I also remember of discuss this here already. It is not too much worrying have big stack sizes, right? Anyway, there is a way to round it? In 15 days I might forget this, and in 30 days another program breaks due to this... :/
Title: Re: First chance exception: Address 0x0044295D Access Violation
Post by: Ionic Wind Support Team on June 16, 2008, 04:34:52 PM
The compiler will warn you if it detects a subroutine exceeding stack size at compile time.  But it can't predict overall stack usage for things like reentrant subroutines, recursion, etc.  Your total stack usage is the size of the local variables in the current execution path.

So if Foo() calls Foo2() which calls Foo3()  then stack usage when Foo3 is running is the total of the local variables defined in all three subroutines. 

The easiest way around it is to change your coding habits.  Don't define mammoth arrays in subroutines. use NEW and DELETE instead and pass a pointer around if you need to.

Paul.
Title: Re: First chance exception: Address 0x0044295D Access Violation
Post by: JoaoAfonso on June 16, 2008, 06:33:46 PM
I guess that slowly I can do it. I learn and use, lets say, at least 1 great trick per month in these foruns :) thank you