If you are talking about Android Application Memory, then
ActivityManager.getMemoryInfo() - This is our highest level API for viewing shared memory usage.
At the lower level, you can use the Debug API to get kernel-level memory usage information.
Note. Starting with version 2.0, there is also an API ActivityManager.getProcessMemoryInfoto get this information about another process.
You can also parse the command /proc/meminfo. and get an answer to the memory information.
EDIT:
ActivityManager activityManager = (ActivityManager) getSystemService(ACTIVITY_SERVICE);
MemoryInfo memoryInfo = new MemoryInfo();
activityManager.getMemoryInfo(memoryInfo);
Log.i("memory free", "" + memoryInfo.availMem);
SO: