This DPMI 0.9 Specification is hosted by Tenberry Software, Inc.

13. Memory Management Services


[Next Section] * [Previous Section] * [DPMI Index]
[Tenberry Home] * [Software Quality] * [DOS/4G] * [DOS/4GW] * [DOS/16M]

These functions are provided to allocate linear address space.


13.1 Get Free Memory Information

This function is provided so that protected mode applications can determine how much memory is available. Under DPMI implementations that support virtual memory, it is important to consider issues such as the amount of available physical memory.

Note that since DPMI applications will often run in multi-tasking environments, this function must be considered only advisory.

To Call

     AX = 0500h
     ES:(E)DI = Selector:Offset of 30h byte buffer

Returns

     If function was successful:
     Carry flag is clear.
     ES:(E)DI = Selector:Offset of buffer with the following structure:

           Offset           Description

            00h   Largest available free block in
                  bytes

            04h   Maximum unlocked page allocation

            08h   Maximum locked page allocation

            0Ch   Linear addr space size in pages

            10h   Total number of unlocked pages

            14h   Number of free pages

            18h   Total number of physical pages

            1Ch   Free linear address space in pages

            20h   Size of paging file/partition in
                  pages

           24h-2Fh    Reserved


     If function was not successful:
     Carry flag is set.

Programmer's Notes


13.2 Allocate Memory Block

This function allocates and commits linear memory.

To Call

     AX = 0501h
     BX:CX = Size of memory block to allocate in bytes

Returns

     If function was successful:
     Carry flag is clear
     BX:CX = Linear address of allocated memory block
     SI:DI = Memory block handle (used to resize and free)

     If function was unsuccessful:
     Carry flag is set

Programmer's Notes


13.3 Free Memory Block

This function frees a memory block that was allocate through the allocate memory block function.

To Call

     AX = 0502h
     SI:DI = Handle of memory block to free

Returns

     If function was successful:
     Carry flag is clear

     If function was unsuccessful:
     Carry flag is set

Programmer's Notes


13.4 Resize Memory Block

This function changes the size of a memory block that was allocated through the allocate memory block function.

To Call

     AX = 0503h
     BX:CX = New size of memory block to allocate in bytes
     SI:DI = Handle of memory block to resize

Returns

     If function was successful:
     Carry flag is clear
     BX:CX = New linear address of memory block
     SI:DI = New handle of memory block

     If function was unsuccessful:
     Carry flag is set

Programmer's Notes


[Next Section] * [Previous Section] * [DPMI Index]
[Tenberry Home] * [Software Quality] * [DOS/4G] * [DOS/4GW] * [DOS/16M]
This HTML edition of the DPMI 0.9 Specification is hosted by Tenberry Software, Inc., makers of the DOS/16M and the DOS/4G family of DOS extenders. Page last modified 2003.1.28, <webmaster@tenberry.com>