Pascal

Moderators: None (Apply to moderate this forum)
Number of threads: 4095
Number of posts: 14004

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
System freezes after program end. Posted by PP2005 on 26 Dec 2006 at 3:44 AM
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?
Report
Re: System freezes after program end. Posted by zibadian on 26 Dec 2006 at 5:15 AM
: 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.
Report
Re: System freezes after program end. Posted by PP2005 on 27 Dec 2006 at 4:09 AM
: 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! :)
Report
Re: System freezes after program end. (SOLVED) Posted by PP2005 on 27 Dec 2006 at 3:08 PM
: 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.



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.