One additional observation:
Just for interest, I tried the memavail function from the original post
- on my office PC at windows 7, FPC 3.0.4, 32 bit - as said above, it always delivers the same result, regardless how much memory the program has allocated.
- on my home PC, an AMD A4-5300 with 4GB RAM, windows 10, FPC 3.0.4, 32 bit. For some reason it is awfully slow under windows 10. The GetMem calls are getting slower and slower as the amount of allocated memory increases, and the routine did in fact not terminate within 10 minutes.
I have to agree this is not a good solution.