free_memory_linux.go 238 B

1234567891011121314151617181920
  1. // +build linux
  2. package main
  3. /*
  4. #include <features.h>
  5. #ifdef __GLIBC__
  6. #include <malloc.h>
  7. #else
  8. void malloc_trim(size_t pad){}
  9. #endif
  10. */
  11. import "C"
  12. import "runtime/debug"
  13. func freeMemory() {
  14. debug.FreeOSMemory()
  15. C.malloc_trim(0)
  16. }