From: Charles Terry Newsgroups: comp.os.msdos.djgpp Subject: Re: DPMI for Dummies Date: Fri, 03 Apr 1998 12:42:59 -0800 Organization: All USENET -- http://www.Supernews.com Lines: 34 Message-ID: <352549D3.5ACA@plinet.com> References: <3523cca3 DOT 0 AT newscene> NNTP-Posting-Host: 11347 AT 207 DOT 174 DOT 3 DOT 133 Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Greg Cheak wrote: > > I have a program called "Cover" (circa 1993) that builds large tables in > memory. It uses a simple call to malloc() to allocate space for these tables. > If the call fails, it returns an error code (NULL). This is usually due to > lack of memory to complete the operation based on the parameters I have set. I > have 32mb RAM. > > The program, a Unix port, compiles straight away with DJGPP. What I would > like to do is use DPMI (CWSDPMI) functions to allocate as much memory as I > can, so that I can set larger paramters for this program. Even running in > Win95 with DPMI set to 65535, the program seems not to see it. Is there sample > code explaining the usage of DPMI in a program? I suspect I would have to use > a swap file as well. > > Oh, the program builds covers ("wheels") using a process called Simulated > Annealing. It works good for smaller designs. With extra memory I could work > on larger ones. > > - Greg Don't worry-be happy! Allocate away. Malloc will allocate virtual memory if no physical memory is available, and the dpmi host will patiently swap from memory to disk behind the scene without any setup on the part of active program. I think that cwsdpmi will handle up to 256 meg. I suspect that the program will actually be more efficient if you malloc your tables as you need instead of trying to grab all the memory you can and manage it yourself. The libc info file has a branch that covers the dpmi functions if you need to map physical addresses, lock memory, ect. Charles