override 64k mem limit??? 
Author Message
 override 64k mem limit???

It seems, as you can not take more variables than 64kb.Is there there a way
to access more memory?
Any help would be greatly appreciated...
-T. Stoffels


Wed, 18 Jun 1902 08:00:00 GMT  
 override 64k mem limit???

Quote:

> It seems, as you can not take more variables than 64kb.Is there there
> a way to access more memory?

use the heap, look for New and Dispose and Getmem and Freemem in your
manuals.

http://www.geocities.com/SiliconValley/2926/tpf.html
page "FAQ", article "Turbo Pascal Memory considerations, pointer primer"
--
Franz Glaser, Glasau 3, A-4191 Vorderweissenbach Austria +43-7219-7035-0
Muehlviertler Elektronik Glaser.  Industrial control and instrumentation
------------------------------------------------------------------------

http://www.geocities.com/~franzglaser/ http://members.xoom.com/f_glaser/



Wed, 18 Jun 1902 08:00:00 GMT  
 override 64k mem limit???
Quote:

> It seems, as you can not take more variables than 64kb.Is there there a way
> to access more memory?
> Any help would be greatly appreciated...
> -T. Stoffels

You have do initialize your variables on the heap! For that, you must
use pointers! Using the heap, you cann access all the available memory
(up to 640kB in real mode, all memory in protected mode).

Example (just using a big array, you can do this with every var!):
type myarray = array[ 0.. 60000 ] of byte;  
var  p       : ^myarray;
Begin
 new( p );  <- This reserves the memory (heap) for this array
 ...
 p^[0] := 255; <- do anything with p! You just have to use p^
                  instead of p!
 dispose( p ); <- Don't forget to relese the memory at the end
End.

regards
--

------------------------------------------------------------------------
Member of Grey Dreams Design: visit http://GreyDreams.home.pages.de !!!!
He who can destroy a thing has the real control over it. (Frank Herbert)
------------------------------------------------------------------------



Wed, 18 Jun 1902 08:00:00 GMT  
 override 64k mem limit???

Quote:

>> It seems, as you can not take more variables than 64kb.Is there there a way
>> to access more memory?
>> Any help would be greatly appreciated...
>> -T. Stoffels
>You have do initialize your variables on the heap! For that, you must
>use pointers! Using the heap, you cann access all the available memory
>(up to 640kB in real mode, all memory in protected mode).

>Example (just using a big array, you can do this with every var!):
>type myarray = array[ 0.. 60000 ] of byte;  
>var  p       : ^myarray;
>Begin
> new( p );  <- This reserves the memory (heap) for this array
> ...
> p^[0] := 255; <- do anything with p! You just have to use p^
>                  instead of p!
> dispose( p ); <- Don't forget to relese the memory at the end

There is no need to release the memory at the end. You need to release
only if you want to reuse the memory within the program.

Quote:
>End.

>regards

Osmo


Wed, 18 Jun 1902 08:00:00 GMT  
 override 64k mem limit???

Quote:

> >Example (just using a big array, you can do this with every var!):
> >type myarray = array[ 0.. 60000 ] of byte;
> >var  p       : ^myarray;
> >Begin
> > new( p );  <- This reserves the memory (heap) for this array
> > ...
> > p^[0] := 255; <- do anything with p! You just have to use p^
> >                  instead of p!
> > dispose( p ); <- Don't forget to relese the memory at the end
> There is no need to release the memory at the end. You need to release
> only if you want to reuse the memory within the program.

Well, I DO think, there is a need: Programming style!
Just put this into a procedure and if you forget the dispose... you soon
will get into big problems...
Probably not YOU, but ME or someone else!

regards
--

------------------------------------------------------------------------
Member of Grey Dreams Design: visit http://GreyDreams.home.pages.de !!!!
He who can destroy a thing has the real control over it. (Frank Herbert)
------------------------------------------------------------------------



Wed, 18 Jun 1902 08:00:00 GMT  
 override 64k mem limit???

Quote:

> There is no need to release the memory at the end. You need to release
> only if you want to reuse the memory within the program.

Why? Is it released automatically at the end of the program? Is there
a difference between real and protected mode regarding this?


Wed, 18 Jun 1902 08:00:00 GMT  
 override 64k mem limit???

Quote:


>> There is no need to release the memory at the end. You need to release
>> only if you want to reuse the memory within the program.

>Why? Is it released automatically at the end of the program? Is there
>a difference between real and protected mode regarding this?

It is released in both cases. In fact in real mode the DOS knows nothing
on what is allocated and what is not, the entire program, is one
allocation in real mode.

Osmo



Wed, 18 Jun 1902 08:00:00 GMT  
 override 64k mem limit???

Quote:
>Well, I DO think, there is a need: Programming style!
>Just put this into a procedure and if you forget the dispose... you soon
>will get into big problems...
>Probably not YOU, but ME or someone else!

Well at least I know when I put something in a procedure and when not.
When the issue is extending global variables by the use of heap then
there is no need to release.

Osmo



Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 8 post ] 

 Relevant Pages 

1. Borland Pascal 64k Limit FAQ

2. rehash - the 64k limit problem

3. 64K Data Size Limits and CTE 49 {Data Segment}

4. 64k Data segment limit

5. 64k variable limit.

6. 64K Limit

7. 64K limit for blobs with Apollo

8. 64k array limit?

9. 64K limit (was: Borland Pascal 8.0)

10. Scrolling in TTerminal and 64K limit

11. Scrolling in TTerminal and 64K limit

12. BLOBs, ODBC, Oracle and the 64K limit. Help more than Welcome.

 

 
Powered by phpBB® Forum Software