ModularM
Modular2y ago
3 replies
benny

Determine Pointer Location

Hey everyone :)

Got stuck on an issue and was wondering if anyone knew how to implement a kind of function to check if a pointer is allocated on the stack or the heap, i.e.

fn is_stack[T: DType](ptr: DTypePointer[T]) -> Bool:
    ...


That returns true for a pointer that was created with stack_allocate[T], but false for DTypePointer[T].alloc
Was this page helpful?