Heap Problem in Turbo Pascal 1.5 on Win95 
Author Message
 Heap Problem in Turbo Pascal 1.5 on Win95

I am writing program in Turbo Pascal ver1.5 under windows  95, but I
need to use some big pointer arrays allocated memory more than 64K
limit. So I delcare the following code:
type heaparr=arrary[0..n,0..n) of integer;
arrpt =^heaparr;
var
    newf:arrpt;
....
....
   new(newf);
  ....
dispose(newf);
...
The program can run no problem if run under dos (using turbo pascal 7)
but when I run under win95, general protection fault message is
displayed and need to quit the program.
How should I do to acheive this by using memory on heap under win95?
Thanks


Sun, 16 May 2004 11:20:07 GMT  
 Heap Problem in Turbo Pascal 1.5 on Win95

Quote:
> I am writing program in Turbo Pascal ver1.5 under windows  95, but I
> need to use some big pointer arrays allocated memory more than 64K
> limit. So I delcare the following code:
> type heaparr=arrary[0..n,0..n) of integer;
> arrpt =^heaparr;
> var
>     newf:arrpt;
> ....
> ....
>    new(newf);
>   ....
> dispose(newf);
> ...

First read the FAQ on the question how to use more than 64 K
memory.!!!!!!!!
The way you are declaring it will still give you not more than the
maximum blocksize of 64 k .

A general protection fault typically happens in windows or protedted mode
for the only reason that you are trying to access something outside the
defined boundaries of your array. In pointer arrays the range checking
does not always warn you for this.
In TP for DOS this will not always result in an error, due to accidently
writing to an empty piece of memory.
Tips:
Try to find the point in the program where the crash occurs!
Very thoroughly check all code involving  arrpt.
most likely:
when assigning values to elements of  newf check that the indexes are not
out of range
e.g.  newf^[i,j]:=X;  {check i and j}
check that no value assignments are made before you called >    new(newf)
or after > dispose(newf);
Check that new and dispose are called only once.

Write a very small test program yust only for trying out the use of
pointers. If that all does not work, send us a piece of code.

Femme



Tue, 18 May 2004 23:28:24 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. need turbo pascal 1.5 for win95

2. Turbo Pascal 1.5 with Win95/98

3. Turbo Pascal 1.5 with Win95/98

4. turbo pascal 1.5 & win95

5. Win95 and Turbo Pascal 1.5

6. Turbo Pascal 1.5 Debugger Problem - HELP!

7. TPW 1.5/Win problems under Win95

8. Win95, Turbo Pascal 7.0 and Graph3.tpu-Unit Problem

9. Why Turbo Pascal for Windows 1.5 ?

10. Turbo Pascal for Windows 1.5 Tutorial

11. Questions: CRT of Turbo Pascal for Windows 1.5

12. Turbo Pascal for Windows 1.5

 

 
Powered by phpBB® Forum Software