Garbage Collection Pitfall in C++ but not in D?
akaz
nemo at utopia.com
Fri Jul 6 20:04:34 PDT 2012
> Won't some functions doing just what addRange() and
> removeRange() do solve that kind of problem (if necessary)?
> That means, forbidding the GC to scan some memory area for some
> time?
Like their C++11 counterparts:
void declare_reachable(void* p); // the region of memory
starting at p
// (and allocated by some allocator
// operation which remembers its size)
// must not be collected
template<class T> T* undeclare_reachable(T* p);
void declare_no_pointers(char* p, size_t n); // p[0..n] holds
no pointers
void undeclare_no_pointers(char* p, size_t n);
More information about the Digitalmars-d-learn
mailing list