delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2014/05/06/17:45:12

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
From: "Rod Pemberton" <dont_use_email AT xnothavet DOT cqm>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Does DJGPP have some function that returns DPMI memory back to
the system?
Date: Tue, 06 May 2014 17:33:29 -0400
Organization: Aioe.org NNTP Server
Lines: 75
Message-ID: <op.xfgjh3xz6zenlw@localhost>
References: <ed3042a0-f663-4941-9d25-ebd6ccc6d26f AT googlegroups DOT com>
NNTP-Posting-Host: CNsg4fVcCsvs3UaOgZtQCw.user.speranza.aioe.org
Mime-Version: 1.0
X-Complaints-To: abuse AT aioe DOT org
User-Agent: Opera Mail/12.16 (Linux)
X-Notice: Filtered by postfilter v. 0.8.2
Bytes: 3577
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

On Sat, 03 May 2014 07:35:03 -0400, <iw2evk AT gmail DOT com> wrote:

> Does DJGPP have some function that returns DPMI memory
> back to the system?

DJGPP has DJGPP functions and DPMI wrapper functions which
free DPMI memory that was allocated by them.

I found this question to be rather odd ...  So, I was going
to wait until someone more experienced with DJGPP answered
first, but that didn't happen.

The reason I found this odd is that you have to allocate
memory before you free it.  If you know how to allocate
memory with DPMI, then you know how to free it too, whether
that's via assembly or DJGPP functions, or you should or
could rather easily determine how to do so.

The other logical option is that you're attempting to
free DPMI memory that either hasn't been allocated, or
was allocated by another program or the DPMI host, in
which case you shouldn't be freeing that memory since
it's not appropriated to your application and/or allocated.

What do you mean by "returns" exactly?  Do you mean free
previously allocated DPMI memory, or do you mean provides
additional DPMI memory because you don't seem to have enough,
or do you mean something else?

So, do you know how to allocate DPMI memory?  If not,
then is there some other issue you're attempting to
bring up or figure out?

Let's start with the presumption that you did do things
correctly to allocate DPMI memory in the first place.

Which of the following functions did you use to allocate?

__dpmi_allocate_dos_memory()
__dpmi_allocate_linear_memory()
__dpmi_allocate_memory()
__dpmi_allocate_shared_memory()
_go32_dpmi_allocate_dos_memory()

Those allocation functions correspond to the free functions:

__dpmi_free_dos_memory()
__dpmi_free_memory()
__dpmi_free_shared_memory()
_go32_dpmi_free_dos_memory()

Each of those has parameters which are documented in
the portion of DJGPP's libc.a reference on DPMI functions:

http://www.delorie.com/djgpp/doc/libc/libc_9.html

If you installed DJGPP correctly, there should be files
in the "info" directory, including libc.info which covers
the entire DJGPP C library.

Until you tell us how you allocated the memory, we can't
tell you how to free it.  But, as I said above, if you
know how to allocate, you should be able to figure out
how to free.

If you don't know how to allocate, you should tell us
what type of memory you're trying to allocate.  Then,
someone can help you select one of the functions above
and tell you how to use it.  The two primary choices
are DOS memory (below 1MB, usually not within a DJGPP
application's memory space) and DPMI memory (above 1MB,
generally easily accessible via a DJGPP C program).


Rod Pemberton

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019