Struct to prevent garbage collection on heaps. More...
#include <HdrHeap.h>
Public Member Functions | |
HeapGuard (HdrHeap *heap, const char *str) | |
Construct the protection. | |
Data Fields | |
Ptr< RefCountObj > | m_ptr |
The heap we protect (if any). |
Struct to prevent garbage collection on heaps.
This bumps the reference count to the heap containing the pointer while the instance of this class exists. When it goes out of scope the reference is dropped. This is useful inside a method or block to keep the required heap data around until leaving the scope.
Definition at line 277 of file HdrHeap.h.
HdrHeap::HeapGuard::HeapGuard | ( | HdrHeap * | heap, | |
const char * | str | |||
) | [inline] |
Construct the protection.
Definition at line 279 of file HdrHeap.h.
References StrHeapDesc::contains(), m_ptr, HdrHeap::m_read_write_heap, StrHeapDesc::m_ref_count_ptr, and HdrHeap::m_ronly_heap.