This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Memory Size

Maybe a stupid question, but here it is.
Has anybody a hint how to runtime determine size of available memory(any space)?

Regards
Eckhard

Parents
  • 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.

Reply
  • 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.

Children