sanitizer_allocator_interface.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. //===-- sanitizer_allocator_interface.h ------------------------- C++ -----===//
  2. //
  3. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  4. // See https://llvm.org/LICENSE.txt for license information.
  5. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  6. //
  7. //===----------------------------------------------------------------------===//
  8. //
  9. // Re-declaration of functions from public sanitizer allocator interface.
  10. //
  11. //===----------------------------------------------------------------------===//
  12. #ifndef SANITIZER_ALLOCATOR_INTERFACE_H
  13. #define SANITIZER_ALLOCATOR_INTERFACE_H
  14. #include "sanitizer_internal_defs.h"
  15. using __sanitizer::uptr;
  16. extern "C" {
  17. SANITIZER_INTERFACE_ATTRIBUTE
  18. uptr __sanitizer_get_estimated_allocated_size(uptr size);
  19. SANITIZER_INTERFACE_ATTRIBUTE int __sanitizer_get_ownership(const void *p);
  20. SANITIZER_INTERFACE_ATTRIBUTE uptr
  21. __sanitizer_get_allocated_size(const void *p);
  22. SANITIZER_INTERFACE_ATTRIBUTE uptr __sanitizer_get_current_allocated_bytes();
  23. SANITIZER_INTERFACE_ATTRIBUTE uptr __sanitizer_get_heap_size();
  24. SANITIZER_INTERFACE_ATTRIBUTE uptr __sanitizer_get_free_bytes();
  25. SANITIZER_INTERFACE_ATTRIBUTE uptr __sanitizer_get_unmapped_bytes();
  26. SANITIZER_INTERFACE_ATTRIBUTE int __sanitizer_install_malloc_and_free_hooks(
  27. void (*malloc_hook)(const void *, uptr),
  28. void (*free_hook)(const void *));
  29. SANITIZER_INTERFACE_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE
  30. void __sanitizer_malloc_hook(void *ptr, uptr size);
  31. SANITIZER_INTERFACE_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE
  32. void __sanitizer_free_hook(void *ptr);
  33. SANITIZER_INTERFACE_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE void
  34. __sanitizer_purge_allocator();
  35. SANITIZER_INTERFACE_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE void
  36. __sanitizer_print_memory_profile(uptr top_percent, uptr max_number_of_contexts);
  37. } // extern "C"
  38. #endif // SANITIZER_ALLOCATOR_INTERFACE_H