Baslic memory question

I am writing a program that needs to check the amount of system memory
available at any one time. Is there a system call I can make that will
return the available memory space to me?

Thank you for your help.