https://github.com/kassane/zig-gpa-ffi
Testing GPA in FFI
https://github.com/kassane/zig-gpa-ffi
allocation allocator bindings cpp ffi ffi-bindings malloc-free memory-allocation memory-management rust rust-allocator-interface zig ziglang
Last synced: 3 months ago
JSON representation
Testing GPA in FFI
- Host: GitHub
- URL: https://github.com/kassane/zig-gpa-ffi
- Owner: kassane
- License: mit
- Created: 2024-12-15T17:20:38.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-06-11T00:52:46.000Z (12 months ago)
- Last Synced: 2025-10-20T00:22:08.306Z (7 months ago)
- Topics: allocation, allocator, bindings, cpp, ffi, ffi-bindings, malloc-free, memory-allocation, memory-management, rust, rust-allocator-interface, zig, ziglang
- Language: Zig
- Homepage:
- Size: 24.4 KB
- Stars: 2
- Watchers: 0
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# zig-gpa-ffi
Testing [`std.heap.DebugAllocator`](https://ziglang.org/documentation/master/std/#std.heap.DebugAllocator) in FFI.
## Required
- Zig 0.14.0 or master
- Rust 1.82.0 or nightly
It is also possible to preload in the posix environment.
```console
zig build-lib -dynamic zig/src/lib.zig --name zalloc
```
```bash
LD_PRELOAD=libzalloc.so {app}
```
## Some references for tests
- Rust [Global Allocator](https://doc.rust-lang.org/std/alloc/trait.GlobalAlloc.html)
- C++ [new](https://en.cppreference.com/w/cpp/memory/new/operator_new)/[delete](https://en.cppreference.com/w/cpp/memory/new/operator_delete) operators override
- C++17 [PMR](https://en.cppreference.com/w/cpp/memory/polymorphic_allocator)