Howdy, Stranger!

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

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

System freezes after program end.

PP2005PP2005 Posts: 111Member
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

  • zibadianzibadian Posts: 6,349Member
    : 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.
  • PP2005PP2005 Posts: 111Member
    : 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! :)
  • PP2005PP2005 Posts: 111Member
    : 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.