|
From: Brian M. <str...@ho...> - 2002-03-06 22:44:57
|
I don't know anything about stack faults, but i do have a knight's tour program that runs without any kind of illegal operations and doesn't use recursive functions. It also works just about all the time. take a look if you want. >From: "Jason Hardman" <jas...@bt...> >To: "Dev-C++" <dev...@li...>, "Mohammed Riyaz" ><p_m...@ho...> >Subject: Re: [Dev-C++] help >Date: Wed, 6 Mar 2002 16:24:43 -0000 > >I couldn't tell you exactly what the problem is without the seeing the >source code, which I'm interested in doing anyway as it's not a problem >I've >come across before. However I can suggest what may be the cause. By any >chance is the algorithm used a recursive one? That could be one reason you >are getting a 'stack fault' as every time you call a method you are >creating >a new set of instance variables (amongst other things) on the stack for it, >and there is only a limited amount of space allocated to the stack usualy. >Notice that in both versions the stack pointer (ESP) is about 00560000h >which is about 5 Meg assuming it started a zero. I think on intel machines >that is the case? > >There may be another cause but that seems the most likely. If you are using >a recursive function then try to reimplement it in a non-recursive manner, >it will be faster that way too. > >If recursive calls are the cause, then this fault also suggests that there >may be an error in the termination condition of the function(s), so you are >going through an infinite number of recursive calls, although it may just >be >that the algorithm requires so many calls that the termination condition >would never be met before a stack overflow. > >This is all just a stab in the dark without seeing the code, but I hope it >helps. > >Jason > >----- Original Message ----- >From: "Mohammed Riyaz" <p_m...@ho...> >To: <dev...@li...> >Sent: Wednesday, March 06, 2002 7:43 AM >Subject: [Dev-C++] help > > > > > > Hey guys, > > > > i wrote a program to solve the knight's problem.(move to every block on >the > > chess board using the knight's movements, but never reach the same block > > twice.) > > > > I feel though i coded the program right my system is unable to run the > > program. > > > > In order to test it i compiled the program with two compilers, as a >result > > both the exe files gave errors. but the exe file created by dev-c++ >compiler > > ran longer than the other(i.e it could try more to reach the result). > > > > the error message for both theexe files was > > " this program has performed an illegal operation and will be shut down" > > > > but the details causing the error were diffrent in the either case: > > > > When compiled with Dev-c++ compiler: > > > > KNIGHT caused a stack fault in module KERNEL32.DLL at 0167:bff7a2a1. > > Registers: > > EAX=0054fffc CS=0167 EIP=bff7a2a1 EFLGS=00000216 > > EBX=78037780 SS=016f ESP=00552018 EBP=00552024 > > ECX=c1413f00 DS=016f ESI=00000024 FS=4d3f > > EDX=bffc9490 ES=016f EDI=81661bc0 GS=0000 > > Bytes at CS:EIP: > > 58 5f 8b e5 5d c3 a1 e8 9c fc bf 8b 08 ff 41 38 > > Stack dump: > > 81660a14 00000002 c1413f00 00552044 bff75d40 00000002 00000024 78037780 > > bffa0001 81660a14 00000000 00552480 78011eb2 0000000c 0055206c 00000002 > > > > > > > > When compiled with borland v5.5 compiler: > > > > KNIGHT caused a stack fault in module KNI.EXE at 0167:0041557a. > > Registers: > > EAX=00000006 CS=0167 EIP=0041557a EFLGS=00010206 > > EBX=00562018 SS=016f ESP=00562000 EBP=0056205c > > ECX=005624f1 DS=016f ESI=005624f1 FS=4d1f > > EDX=00000000 ES=016f EDI=0000000a GS=0000 > > Bytes at CS:EIP: > > 55 53 56 57 8b 5c 24 14 8b 4c 24 18 0b c9 75 08 > > Stack dump: > > 00415991 0000000a 00000000 00000024 005625e6 00562664 004159a4 0000000a > > 00000000 00000024 005625fe 00562664 00000001 00000020 0056260e 00562664 > > > > > > cud some one tell me what i cud do? > > i didnt use dynamic memory allocation in my program. > > -riyaz > > > > ======================================================================== > > P.Mohammed riyaz > > Student, Computer Science And Engineering > > ======================================================================== > > > > > > _________________________________________________________________ > > Chat with friends online, try MSN Messenger: http://messenger.msn.com > > > > > > _______________________________________________ > > Dev-cpp-users mailing list > > Dev...@li... > > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > > >_______________________________________________ >Dev-cpp-users mailing list >Dev...@li... >https://lists.sourceforge.net/lists/listinfo/dev-cpp-users _________________________________________________________________ Chat with friends online, try MSN Messenger: http://messenger.msn.com |