Luna/libluna/include/luna/Heap.h
apio b1e400d795
All checks were successful
continuous-integration/drone/push Build is passing
libluna: Allow callers to optimize heap allocations by telling us they won't resize the returned memory
strdup() now does this. If someone resizes strdup()-ed memory, nothing bad will happen, they will just take a small performance hit the first time.

But I think realloc-ing strdup()-ed memory is rare, that's why I did this.
2023-04-27 17:36:25 +02:00

31 lines
865 B
C++

#pragma once
#include <luna/Result.h>
namespace std
{
struct nothrow_t
{
explicit nothrow_t() = default;
};
extern const nothrow_t nothrow;
enum class align_val_t : usize
{
};
};
void* operator new(usize size, const std::nothrow_t&) noexcept;
void* operator new[](usize size, const std::nothrow_t&) noexcept;
void operator delete(void* ptr, usize size, std::align_val_t alignment) noexcept;
extern Result<void*> allocate_pages_impl(usize count);
extern Result<void> release_pages_impl(void* address, usize count);
Result<void*> malloc_impl(usize size, bool may_realloc = true, bool should_scrub = true);
Result<void*> calloc_impl(usize nmemb, usize size, bool may_realloc = true);
Result<void*> realloc_impl(void* ptr, usize size, bool may_realloc_again = true);
Result<void> free_impl(void* ptr);
void dump_heap_usage();