Maybe a stupid question, but here it is. Has anybody a hint how to runtime determine size of available memory(any space)? Regards Eckhard
I have not tried it myself, but a method that might work is to repeatedly call malloc to reserve memory - freeing the memory again immediatly afterwards. Looking at MALLOC.C, it seems that malloc() will return a NULL if it cannot allocate memory. A binary search passing different sized requests to malloc() should quickly home-in on the exact amount of memory available. Good luck.
But how would malloc know where memory ends?
What about fragmentation?