diff options
Diffstat (limited to 'lib/std')
| -rw-r--r-- | lib/std/heap.zig | 1 | ||||
| -rw-r--r-- | lib/std/heap/memory_pool.zig | 22 |
2 files changed, 10 insertions, 13 deletions
diff --git a/lib/std/heap.zig b/lib/std/heap.zig index e6c17aeebb..b662cd39bd 100644 --- a/lib/std/heap.zig +++ b/lib/std/heap.zig @@ -29,7 +29,6 @@ pub const MemoryPoolOptions = memory_pool.Options; /// TODO Utilize this on Windows. pub var next_mmap_addr_hint: ?[*]align(mem.page_size) u8 = null; - const CAllocator = struct { comptime { if (!builtin.link_libc) { diff --git a/lib/std/heap/memory_pool.zig b/lib/std/heap/memory_pool.zig index e370803e64..6ae90a3894 100644 --- a/lib/std/heap/memory_pool.zig +++ b/lib/std/heap/memory_pool.zig @@ -5,15 +5,15 @@ const debug_mode = @import("builtin").mode == .Debug; pub const MemoryPoolError = error{OutOfMemory}; /// A memory pool that can allocate objects of a single type very quickly. -/// Use this instead of a general purpose allocator when you need to allocate a lot of objects -/// of the same type, as a memory pool outperforms general purpose allocators. +/// Use this when you need to allocate a lot of objects of the same type, +/// because It outperforms general purpose allocators. pub fn MemoryPool(comptime Item: type) type { return MemoryPoolAligned(Item, @alignOf(Item)); } /// A memory pool that can allocate objects of a single type very quickly. -/// Use this instead of a general purpose allocator when you need to allocate a lot of objects -/// of the same type, as a memory pool outperforms general purpose allocators. +/// Use this when you need to allocate a lot of objects of the same type, +/// because It outperforms general purpose allocators. pub fn MemoryPoolAligned(comptime Item: type, comptime alignment: u29) type { if (@alignOf(Item) == alignment) { return MemoryPoolExtra(Item, .{}); @@ -32,20 +32,18 @@ pub const Options = struct { }; /// A memory pool that can allocate objects of a single type very quickly. -/// Use this instead of a general purpose allocator when you need to allocate a lot of objects -/// of the same type, as a memory pool outperforms general purpose allocators. +/// Use this when you need to allocate a lot of objects of the same type, +/// because It outperforms general purpose allocators. pub fn MemoryPoolExtra(comptime Item: type, comptime pool_options: Options) type { return struct { const Pool = @This(); - /// Size of the memory pool items. This is not necessarily - /// the same as `@sizeOf(Item)` as the pool also uses the items for internal - /// means. + /// Size of the memory pool items. This is not necessarily the same + /// as `@sizeOf(Item)` as the pool also uses the items for internal means. pub const item_size = std.math.max(@sizeOf(Node), @sizeOf(Item)); - /// Alignment of the memory pool items. This is not necessarily - /// the same as `@alignOf(Item)` as the pool also uses the items for internal - /// means. + /// Alignment of the memory pool items. This is not necessarily the same + /// as `@alignOf(Item)` as the pool also uses the items for internal means. pub const item_alignment = std.math.max(@alignOf(Node), pool_options.alignment orelse 0); const Node = struct { |
