Low-level memory management using Panama FFI.
This namespace provides the foundational memory primitives used throughout clj-ebpf. It wraps Java's Foreign Function & Memory API (Panama) to provide a Clojure-friendly interface for:
INTERNAL: This namespace is for internal use only. Public APIs should use clj-ebpf.utils for memory operations.
Low-level memory management using Panama FFI. This namespace provides the foundational memory primitives used throughout clj-ebpf. It wraps Java's Foreign Function & Memory API (Panama) to provide a Clojure-friendly interface for: - Memory allocation and deallocation - Reading and writing primitive types - Memory segment manipulation - Buffer management for BPF operations INTERNAL: This namespace is for internal use only. Public APIs should use clj-ebpf.utils for memory operations.
(allocate size)(allocate size alignment)Allocate native memory of given size with optional alignment. Returns a MemorySegment.
Allocate native memory of given size with optional alignment. Returns a MemorySegment.
(allocate-array element-layout count)Allocate an array of elements with the given layout.
Allocate an array of elements with the given layout.
(allocate-zeroed size)Allocate zeroed native memory of given size.
Allocate zeroed native memory of given size.
(bytes->segment bytes)Write bytes from a byte array to a new memory segment.
Write bytes from a byte array to a new memory segment.
(copy-segment dst dst-offset src src-offset length)Copy bytes from src segment to dst segment.
Copy bytes from src segment to dst segment.
(create-auto-arena)Create an auto-managed arena (GC-collected).
Create an auto-managed arena (GC-collected).
(create-confined-arena)Create a confined arena for explicit memory management. Must be closed when done.
Create a confined arena for explicit memory management. Must be closed when done.
(create-shared-arena)Create a shared arena for multi-threaded access. Must be closed when done.
Create a shared arena for multi-threaded access. Must be closed when done.
(fill-memory seg size value)Fill memory segment with a byte value.
Fill memory segment with a byte value.
(from-address address size)Create a memory segment from a native address. Warning: This is unsafe and should be used carefully.
Create a memory segment from a native address. Warning: This is unsafe and should be used carefully.
(null-segment? seg)Check if a memory segment is NULL.
Check if a memory segment is NULL.
(read-byte seg offset)Read a byte from memory segment at offset.
Read a byte from memory segment at offset.
(read-int seg offset)Read an int from memory segment at offset.
Read an int from memory segment at offset.
(read-int-be seg offset)Read a big-endian int from memory segment at offset.
Read a big-endian int from memory segment at offset.
(read-int-le seg offset)Read a little-endian int from memory segment at offset.
Read a little-endian int from memory segment at offset.
(read-long seg offset)Read a long from memory segment at offset.
Read a long from memory segment at offset.
(read-long-be seg offset)Read a big-endian long from memory segment at offset.
Read a big-endian long from memory segment at offset.
(read-long-le seg offset)Read a little-endian long from memory segment at offset.
Read a little-endian long from memory segment at offset.
(read-pointer seg offset)Read a pointer from memory segment at offset.
Read a pointer from memory segment at offset.
(read-short seg offset)Read a short from memory segment at offset.
Read a short from memory segment at offset.
(read-short-be seg offset)Read a big-endian short from memory segment at offset.
Read a big-endian short from memory segment at offset.
(read-short-le seg offset)Read a little-endian short from memory segment at offset.
Read a little-endian short from memory segment at offset.
(reinterpret seg new-size)Reinterpret a memory segment with a new size.
Reinterpret a memory segment with a new size.
(segment->buffer seg)Create a ByteBuffer view of a memory segment.
Create a ByteBuffer view of a memory segment.
(segment->bytes seg size)Read bytes from a memory segment into a byte array.
Read bytes from a memory segment into a byte array.
(segment->string seg)(segment->string seg max-len)Read a null-terminated string from a memory segment.
Read a null-terminated string from a memory segment.
(segment-address seg)Get the native address of a memory segment.
Get the native address of a memory segment.
(segment-size seg)Get the size of a memory segment.
Get the size of a memory segment.
(slice seg offset size)Create a slice of a memory segment.
Create a slice of a memory segment.
(string->segment s)Convert a string to a null-terminated memory segment.
Convert a string to a null-terminated memory segment.
(with-confined-arena & body)Execute body with a confined arena that is closed after execution.
Execute body with a confined arena that is closed after execution.
(with-shared-arena & body)Execute body with a shared arena that is closed after execution.
Execute body with a shared arena that is closed after execution.
(wrap-bytes bytes)Wrap a byte array as a memory segment (no copy).
Wrap a byte array as a memory segment (no copy).
(write-byte seg offset value)Write a byte to memory segment at offset.
Write a byte to memory segment at offset.
(write-int seg offset value)Write an int to memory segment at offset.
Write an int to memory segment at offset.
(write-int-be seg offset value)Write a big-endian int to memory segment at offset.
Write a big-endian int to memory segment at offset.
(write-int-le seg offset value)Write a little-endian int to memory segment at offset.
Write a little-endian int to memory segment at offset.
(write-long seg offset value)Write a long to memory segment at offset.
Write a long to memory segment at offset.
(write-long-be seg offset value)Write a big-endian long to memory segment at offset.
Write a big-endian long to memory segment at offset.
(write-long-le seg offset value)Write a little-endian long to memory segment at offset.
Write a little-endian long to memory segment at offset.
(write-pointer seg offset value)Write a pointer to memory segment at offset.
Write a pointer to memory segment at offset.
(write-short seg offset value)Write a short to memory segment at offset.
Write a short to memory segment at offset.
(write-short-be seg offset value)Write a big-endian short to memory segment at offset.
Write a big-endian short to memory segment at offset.
(write-short-le seg offset value)Write a little-endian short to memory segment at offset.
Write a little-endian short to memory segment at offset.
(zero-memory seg size)Zero out memory segment.
Zero out memory segment.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |