[fpc-pascal]Retrieving memory size?

Marco van de Voort marcov at stack.nl
Thu Mar 27 16:51:34 CET 2003

> Dear all, I am trying to retrieve the memory size.

What memory size? Physical, virtual, both, physical-kernel?

> As maxavail and memavail
> only gives the current available heap size (grows dynamically with the need) I
> can not use these functions for this purpose. Are there any ways to retrieve
> it in a cross-platform way?

There is no way yet, the only way would be to create a unit and implement
them on all platforms.

- BSD (4.4 and derivates including Solaris) and Linux could use sysctl(2) to get kernel
values, and probably some of these values. (FreeBSD calls it hw.physmem

- For Dos you can get an idea by checking the CMOS and/or DPMI hosts etc, but
there is no full proof way. (a lot of bioses return 64 MB for compability

For the rest (Netware,windows,OS/2,other unices or derivates if they don't
support sysctl or don't allow enough values), you'd have to implement it in a platform
specific way.

More information about the fpc-pascal mailing list