BASIC

Author Topic: Crash test  (Read 7253 times)

Offline bigsofty

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 2628
    • View Profile
Re: Crash test
« Reply #15 on: 2011-Sep-15 »
I don't think there should be a great need for a large stack size in the demo, the recursion is mainly used in the parent child relationship within the entity tree(which is basically quaternions and matrices). As the demo does not use any child entities, I am at a bit of a loss. Still, I see no harm in looking for a stack command line option to try it any-ways.

Thanks for everyone's help and suggestions.

Cheers,

Ian.

“It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration.”
(E. W. Dijkstra)

Offline Slydog

  • Prof. Inline
  • *****
  • Posts: 930
  • KodeSource
    • View Profile
    • KodeSource
Re: Crash test
« Reply #16 on: 2011-Sep-15 »
You could add a STATIC recursion count variable in the function to limit how deep it goes.
(Add 1 when enter function, subtract 1 when exit function, if > 30 then . . .)
May not work for a release, but may let you know that is the problem.
My current project (WIP) :: TwistedMaze <<  [Updated: 2015-11-25]

Offline bigsofty

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 2628
    • View Profile
Re: Crash test
« Reply #17 on: 2011-Sep-15 »
Thanks for the tip. I'll add that to my testing.
Cheers,

Ian.

“It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration.”
(E. W. Dijkstra)

Offline Ian Price

  • Administrator
  • Prof. Inline
  • *******
  • Posts: 4147
  • On the shoulders of giants.
    • View Profile
    • My Apps
Re: Crash test
« Reply #18 on: 2011-Sep-15 »
Crashed after about 1min on Win7 64bit.
I came. I saw. I played.

Offline bigsofty

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 2628
    • View Profile
Re: Crash test
« Reply #19 on: 2011-Sep-16 »
OK, this is really strange. I cut code down to almost nothing and I am still getting the same error.

What I have here is a simple IMPORTed call to a C function(which does nothing). A main loop that calls it many times. Its basically a cut down version of how the main project runs.

Yet, if you run Task Manager, there is a memory leak and eventually the same crash occurs as in the larger project.

I can't see the problem, I think my limited C knowledge may be failing me here.  :noggin:

Any-ways, if you could download this project, run it with Task Manger visible, to observe the memory leak and wait for the crash.

Oh, you will need to change the include path in the 'cmp' command line option within the project options (Currently -I"C:\Users\Dad\Desktop\test2\src").

Thanks for your help.

[attachment deleted by admin]
Cheers,

Ian.

“It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration.”
(E. W. Dijkstra)

MrTAToad

  • Guest
Re: Crash test
« Reply #20 on: 2011-Sep-16 »
From my tests, I think SHOWSCREEN is leaking for some reason - I've emailed Gernot about it...

Offline bigsofty

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 2628
    • View Profile
Re: Crash test
« Reply #21 on: 2011-Sep-16 »
I don't think it's SHOWSCREEN as I used my own GL 'flip' as part of the debug process and it had the same result. I believe the problem may lay with the IMPORT command itself leaking. Possibly pushing double return addresses onto the stack before calling?
Cheers,

Ian.

“It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration.”
(E. W. Dijkstra)

MrTAToad

  • Guest
Re: Crash test
« Reply #22 on: 2011-Sep-16 »
Yes, quite possible

I presume the calling convention is correct ?
« Last Edit: 2011-Sep-16 by MrTAToad »

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10713
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
Re: Crash test
« Reply #23 on: 2011-Sep-17 »
your C functions are not declared as "__stdcall", so remove that from the IMPORT or add it to the C functions.

Offline bigsofty

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 2628
    • View Profile
Re: Crash test
« Reply #24 on: 2011-Sep-17 »
Aha, I had assumed that the default calling convention was stdcall, this was a mistake.

Thanks to Gernot and everyone who helped me in this thread.  :good:

Cheers,

Ian.

“It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration.”
(E. W. Dijkstra)