OS/2 codes: How to get size of free physical memory
OS/2 provides APIs to get size of being interested in system memory. For example, DosQuerySysInfo() with QSV_TOTPHYSMEM for total size of physical memory, QSV_TOTRESMEM for total size of system-resident memory, and QSV_TOTAVAILMEM for total size of total available memory for all processes. However, those indice do not tell us about free physical memory. Actually, any 32-bits APIs do not provide such information at all. Instead, you can use 16-bits APIs. That is, DosMemAvail() . Here is the prototype of DosMemAvail(): APIRET16 APIENTRY16 Dos16MemAvail( PULONG pulAvailMem ) For details, see https://komh.github.io/os2books/prcp/080_L2_DosMemAvail.html . VisualAge C++ and Watcom can use this prototype directly. However, unfortunately, gcc does not provide features to call 16-bits functions directly. Instead, you should use thunking. Fortunately, kLIBC provides macros for thunking. You can call DosMemAvail() on gcc/kLIBC like this: Colored By Color Scripter ™ 1 2 3 4 5 6 7 8 9 USHORT...