aboutsummaryrefslogtreecommitdiff
path: root/lib/std/mem
AgeCommit message (Collapse)Author
2022-07-23Revert "std.mem.Allocator: add alignedCreate"Veikka Tuominen
This reverts commit 5647a73fea7ecc9e1ee190362ef47f402eb95dff.
2022-07-23std.mem.Allocator: add alignedCreatedevins2518
2022-05-02Allocator: correct `PanicFree` function nameLee Cannon
2022-04-05zig fmt: remove trailing whitespace on doc commentsDamien Firmenich
Fixes #11353 The renderer treats comments and doc comments differently since doc comments are parsed into the Ast. This commit adds a check after getting the text for the doc comment and trims whitespace at the end before rendering. The `a = 0,` in the test is here to avoid a ParseError while parsing the test.
2022-01-26std.mem.Allocator: upgrade to new function pointer semanticsAndrew Kelley
2021-12-19Allocator: `allocBytes` and `reallocBytes` (#10352)Lee Cannon
Closes #10348
2021-12-19stage1, stage2: rename c_void to anyopaque (#10316)Isaac Freund
zig fmt now replaces c_void with anyopaque to make updating code easy.
2021-12-02allocator: Move vtable into gen structLee Cannon
2021-11-30allocgate: change resize to return optional instead of errorLee Cannon
2021-11-30allocgate: split free out from resizeLee Cannon
2021-11-30allocgate: apply missed changesLee Cannon
2021-11-30allocgate: utilize a *const vtable fieldLee Cannon
2021-11-30allocgate: std Allocator interface refactorLee Cannon
2021-11-30std lib API deprecations for the upcoming 0.9.0 releaseAndrew Kelley
See #3811
2021-11-09std: Publicize Allocator.reallocBytesSilver
This is useful when dealing with runtime-known alignments, eg. interfacing with C code that accepts custom allocation callbacks. Closes #9394
2021-09-22FIX resize() for non u8 element types. (#9806)Coleman Broaddus
2021-08-24remove redundant license headers from zig standard libraryAndrew Kelley
We already have a LICENSE file that covers the Zig Standard Library. We no longer need to remind everyone that the license is MIT in every single file. Previously this was introduced to clarify the situation for a fork of Zig that made Zig's LICENSE file harder to find, and replaced it with their own license that required annual payments to their company. However that fork now appears to be dead. So there is no need to reinforce the copyright notice in every single file.
2021-06-21fix code broken from previous commitJacob G-W
2021-02-25std: Clear old memory on freeLemonBoy
Re-enable the clear-on-free step, it was previously disabled due to translate-c using freed memory.
2020-12-31Year++Frank Denis
2020-09-29use Allocator.allocSentinel now that the stage1 bug is fixedAndrew Kelley
Thanks @LemonBoy!
2020-09-06Merge pull request #6239 from pfgithub/patch-1Andrew Kelley
Support allocating 0 bit types
2020-09-03update uses of deprecated type field accessVexu
2020-09-02"Support" allocating 0 bit typespfg
2020-08-20add license header to all std lib filesAndrew Kelley
add SPDX license identifier copyright ownership is zig contributors
2020-08-11std.mem.Allocator: fix not passing return_addressAndrew Kelley
This makes collected stack traces omit less useful frames. For user applications which only store a fixed number of stack frames this can make a big difference.
2020-08-08std.mem.Allocator: add return_address to the interfaceAndrew Kelley
The high level Allocator interface API functions will now do a `@returnAddress()` so that stack traces captured by allocator implementations have a return address that does not include the Allocator overhead functions. This makes `4` a more reasonable default for how many stack frames to capture.
2020-08-07std: introduce GeneralPurposeAllocatorAndrew Kelley
`std.GeneralPurposeAllocator` is now available. It is a function that takes a configuration struct (with default field values) and returns an allocator. There is a detailed description of this allocator in the doc comments at the top of the new file. The main feature of this allocator is that it is *safe*. It prevents double-free, use-after-free, and detects leaks. Some deprecation compile errors are removed. The Allocator interface gains `old_align` as a new parameter to `resizeFn`. This is useful to quickly look up allocations. `std.heap.page_allocator` is improved to use mmap address hints to avoid obtaining the same virtual address pages when unmapping and mapping pages. The new general purpose allocator uses the page allocator as its backing allocator by default. `std.testing.allocator` is replaced with usage of this new allocator, which does leak checking, and so the LeakCheckAllocator is retired. stage1 is improved so that the `@typeInfo` of a pointer has a lazy value for the alignment of the child type, to avoid false dependency loops when dealing with pointers to async function frames. The `std.mem.Allocator` interface is refactored to be in its own file. `std.Mutex` now exposes the dummy mutex with `std.Mutex.Dummy`. This allocator is great for debug mode, however it needs some work to have better performance in release modes. The next step will be setting up a series of tests in ziglang/gotta-go-fast and then making improvements to the implementation.