TachyonUI 1.1.0
High-performance UI for building tools.
Loading...
Searching...
No Matches
gui_library_allocator.h
Go to the documentation of this file.
1#pragma once
2
4
5#include <cstddef>
6
7// The memory functions HarfBuzz, skribidi, SheenBidi and nanosvg are built to call in place
8// of malloc, calloc, realloc and free. Each block remembers what made it (the C heap or a set
9// of hooks), so it is always freed by that, whatever is routed by then.
10extern "C"
11{
12 void* tachyon_library_malloc(size_t size);
13 void* tachyon_library_calloc(size_t count, size_t size);
14 void* tachyon_library_realloc(void* ptr, size_t size);
15 void tachyon_library_free(void* ptr);
16}
17
18namespace tachyon
19{
22
26 {
28 using RouteHandle = const void*;
29
33
36 void Unroute(RouteHandle route);
37
39 bool IsRouted();
40
45 {
46 public:
49 HeapScope(const HeapScope&) = delete;
50 HeapScope& operator=(const HeapScope&) = delete;
51 };
52 }
53
54}
HeapScope(const HeapScope &)=delete
HeapScope & operator=(const HeapScope &)=delete
void * tachyon_library_calloc(size_t count, size_t size)
void * tachyon_library_realloc(void *ptr, size_t size)
void * tachyon_library_malloc(size_t size)
void tachyon_library_free(void *ptr)
Where the text and SVG libraries (HarfBuzz, skribidi, SheenBidi, nanosvg) get their memory: the C hea...
Definition gui_library_allocator.h:26
void Unroute(RouteHandle route)
Back to the C heap, if route is still the one in place.
const void * RouteHandle
A route, as Route returns it; null when nothing was routed.
Definition gui_library_allocator.h:28
bool IsRouted()
Whether the libraries allocate through hooks right now.
RouteHandle Route(const AllocationHooks &hooks)
From now on the libraries allocate through hooks.
Definition gui_logging.h:24
Memory functions a host gives the library, for the allocations that can be routed: Vulkan objects,...
Definition gui_allocation_hooks.h:17