1
0

free_linux.go 251 B

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