malloc.h 820 B

1234567891011121314151617181920212223242526272829303132
  1. #pragma once
  2. #include <string.h>
  3. #include <util/system/compiler.h>
  4. namespace NMalloc {
  5. struct TMallocInfo {
  6. TMallocInfo();
  7. const char* Name;
  8. bool (*SetParam)(const char* param, const char* value);
  9. const char* (*GetParam)(const char* param);
  10. bool (*CheckParam)(const char* param, bool defaultValue);
  11. };
  12. extern volatile bool IsAllocatorCorrupted;
  13. void AbortFromCorruptedAllocator(const char* errorMessage = nullptr);
  14. // this function should be implemented by malloc implementations
  15. TMallocInfo MallocInfo();
  16. struct TAllocHeader {
  17. void* Block;
  18. size_t AllocSize;
  19. void Y_FORCE_INLINE Encode(void* block, size_t size, size_t signature) {
  20. Block = block;
  21. AllocSize = size | signature;
  22. }
  23. };
  24. }