bh_memutils.h 887 B

1234567891011121314151617181920212223242526272829303132333435
  1. /*
  2. * Copyright (C) 2024 Amazon Inc. All rights reserved.
  3. * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. */
  5. #ifndef _BH_MEMUTILS_H
  6. #define _BH_MEMUTILS_H
  7. #include "bh_platform.h"
  8. #ifdef __cplusplus
  9. extern "C" {
  10. #endif
  11. /**
  12. * Remaps memory by mapping a new region, copying data from the old
  13. * region and umapping the old region.
  14. *
  15. * Unless the behavior is desired, in most cases os_mremap should be used
  16. * as it's at worst equally slow as this function, and on some platforms
  17. * (e.g. posix with mremap) os_mremap will perform better.
  18. *
  19. * @param old_addr an old address.
  20. * @param old_size a size of the old address.
  21. * @param new_size a size of the new memory region.
  22. * @return a pointer to the new memory region.
  23. */
  24. void *
  25. bh_memory_remap_slow(void *old_addr, size_t old_size, size_t new_size);
  26. #ifdef __cplusplus
  27. }
  28. #endif
  29. #endif /* end of _BH_MEMUTILS_H */