lib/gpalloc/src/config.zig
daab053ee43316e1809a84551d573ddd1e5bf3d2
1 const size_class = @import("class.zig");
2
3 const default_large_cache_limit_bytes: usize = 256 * 1024 * 1024;
4
5 pub const PageProvider = enum {
6 backing_allocator,
7 os,
8 };
9
10 pub const RetainedEmptyPagePolicy = enum {
11 keep_committed,
12 discard_unused,
13 };
14
15 pub const Config = struct {
16 thread_safe: bool = true,
17 empty_page_retention_limit: usize = 1,
18 empty_page_reuse_limit: usize = 512,
19 thread_cache: bool = true,
20 flush_thread_cache_on_thread_exit: bool = true,
21 thread_cache_active_limit: usize = 0,
22 thread_cache_retention_limit: usize = 8,
23 large_cache: bool = true,
24 large_cache_limit_bytes: usize = default_large_cache_limit_bytes,
25 collect_stats: bool = false,
26 page_provider: PageProvider = .backing_allocator,
27 retained_empty_page_policy: RetainedEmptyPagePolicy = .keep_committed,
28 };
29
30 pub const min_alignment = size_class.min_alignment;
31 pub const page_size = size_class.page_size;
32 pub const max_small_size = size_class.max_small_size;
33 pub const class_sizes = size_class.sizes;