System freezes after program end.

Hi gang!

I've been working on a program for some time now without any massive problems, but now I'm facing an odd problem. The problem occured after I added a simple FOR ... TO ... DO statement to a procedure in one of my units. The program compiles and runs without any problems, but as soon as I exit the program, Borland Pascal closes and I get an "Illegal operation" Window in Win95. If I remove this simple FOR/TO/DO statement, no problem. I tried running the compiled exe in pure DOS - the same thing happens, except the program just freezes when I exit it. Actually, it doesn't even return to the MS-DOS prompt - the last screen displayed while running the program just remains frozen on screen.

I really can't figure out why this suddenly happens just because I add a simple FOR/TO/DO statement which only uses a single Byte variable. I've tried increasing the memory sizes, but that didn't change anything.

Does anybody have an idea what this problem could be caused by?

Comments

  • : Hi gang!
    :
    : I've been working on a program for some time now without any massive problems, but now I'm facing an odd problem. The problem occured after I added a simple FOR ... TO ... DO statement to a procedure in one of my units. The program compiles and runs without any problems, but as soon as I exit the program, Borland Pascal closes and I get an "Illegal operation" Window in Win95. If I remove this simple FOR/TO/DO statement, no problem. I tried running the compiled exe in pure DOS - the same thing happens, except the program just freezes when I exit it. Actually, it doesn't even return to the MS-DOS prompt - the last screen displayed while running the program just remains frozen on screen.
    :
    : I really can't figure out why this suddenly happens just because I add a simple FOR/TO/DO statement which only uses a single Byte variable. I've tried increasing the memory sizes, but that didn't change anything.
    :
    : Does anybody have an idea what this problem could be caused by?
    :
    Without seeing the loop, my guess is probably an uninitialized pointer or a memory overflow.
  • : Without seeing the loop, my guess is probably an uninitialized pointer or a memory overflow.
    :

    Yeah, that's the feeling I've had too. However, I believe all my pointers are initialized and disposed of properly. Also, if that was the problem, why would it only occur now, after I've added a FOR loop?

    Wouldn't a memory overflow cause an error message when running the program from within Borland Pascal's IDE?

    I'll try to go through my code with a fine comb. Maybe I've overlooked something...

    Thanks for the reply! :)
  • : Yeah, that's the feeling I've had too. However, I believe all my pointers are initialized and disposed of properly. Also, if that was the problem, why would it only occur now, after I've added a FOR loop?
    :
    : Wouldn't a memory overflow cause an error message when running the program from within Borland Pascal's IDE?
    :
    : I'll try to go through my code with a fine comb. Maybe I've overlooked something...
    :
    : Thanks for the reply! :)


    Yep, I overlooked something, as usual. I was using a [X]^[Y] pointer array, which I thought was zero based, but it was 1 based, so when I accessed 0,0 the program freezed when ending.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories