postgres_extension/utils/
memutils.rs

1
2#[repr(C)]
3pub struct MemoryContextData { _unused: [u8; 0] } // opaque
4
5pub type MemoryContext = *mut MemoryContextData;
6
7extern "C" {
8    pub static CurrentMemoryContext: MemoryContext;
9}
10
11pub mod c {
12    use crate::utils::memutils::*;
13    extern "C" {
14        pub fn MemoryContextAlloc(context: MemoryContext, size: usize) -> *mut u8;
15        pub fn pfree(ptr: *mut u8) -> ();
16    }
17}