Article View: comp.lang.pascal.borland
Article #271Re: Turbo Pascal memory
From: Mike Copeland
Date: Wed, 30 Jun 1999 00:00
Date: Wed, 30 Jun 1999 00:00
30 lines
2477 bytes
2477 bytes
> Does anybody know exactly how Turbo Pascal 7.0 does the memory > management? I have a program with lots and lots of pointers to get > running under Windows NT and I always get memory overflows. I think > that Turbo Pascal does not use the whole 128MB RAM I have but only the > first 16MB. If yes, is there any way to change this? Do I have to > compile using TP or TPX. What are the differences? Are there any > compiler flags I have to use? First, Turbo Pascal 7.0 has access only to Real Memory - the 640K in which programs execute. You can allocate and use several pages of 64KB of Heap data, using pointers, and the total amount of Heap is dependent on several factors: 1. Whether or not you're executing your program in the TP IDE (not a good way to do it if you're using pointers or making Exec calls); 2. How much Real Memory is being allocated to the DOS process you're running. I don't know how NT does it, but you need to maximize this value...and you should be working with 600K+ to have maximum resources available; 3. The value MemAvail returns when you call it as your program executes (affected by whatever's running when you execute your program); 4. The treatment of pointers which have been used and aren't needed any more - are you releasing them? All told, you should be able to use at least 400K of Heap memory (in 64KB chunks), providing you deal correctly with the above issues. You can also use Overlays, to make your program smaller and make even more Heap memory available...depending on the application, of course. Most of all, _don't_ run your program in the IDE, because it consumes an enormous amount of Real Memory while it's in execution - it doesn't swap out when your compiled program executes. Compile to Disk and execute it as a DOS application.
Technical Details
Message-ID:
<MPG.11e4a23a4229c806989c43@news.primenet.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<UKre3.16340$U4.829299@carnaval.risq.qc.ca>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111659,d7888456b702217d X-Google-Attributes: gid111659,public X-Google-Thread: 108ebd,d7888456b702217d X-Google-Attributes: gid108ebd,public From: mrcope@primenet.com (Mike Copeland) Subject: Re: Turbo Pascal memory Date: 1999/06/30 Message-ID: <MPG.11e4a23a4229c806989c43@news.primenet.com> X-Deja-AN: 495891363 References: <UKre3.16340$U4.829299@carnaval.risq.qc.ca> X-Complaints-To: abuse@globalcenter.net Organization: Copeland Computer Services X-Posted-By: @206.132.48.198 (mrcope) Newsgroups: comp.lang.pascal.borland,borland.public.turbopascal