diff --git a/env/posix/ocf_env.h b/env/posix/ocf_env.h index 9220d1e..c82cf64 100644 --- a/env/posix/ocf_env.h +++ b/env/posix/ocf_env.h @@ -195,9 +195,18 @@ static inline void env_secure_free(const void *ptr, size_t size) } } +#include + static inline uint64_t env_get_free_memory(void) { - return (uint64_t)(-1); + struct sysinfo info; + int ret; + + ret = sysinfo(&info); + if (ret != 0) + return 0; + + return (uint64_t)info.totalram * info.mem_unit; } /* ALLOCATOR */