4 ms·
Borrowing is just a pointer, no allocation at all. It can point at anything, heap or stack.
by steveklabnik 6y ago
Borrowing is just a pointer, no allocation at all. It can point at anything, heap or stack.
- scrubs 6y agoRight. My question was off base there. Should have focused on memory ownership insofar as where the memory goes when deallocated.
- steveklabnik 6y agoThe usual case is the same as C; commonly a call to free, but if you’ve written your own allocator or something, you get to decide. The language doesn’t know anything about heap allocation, it’s a library thing.