Memory usage in mac os

Both give accurate numbers on memory usage. Only difference is that one is using system commands, other is by writing C code.