About ptr sharing

I'm not sure if this needs to be said strictly, but I would like to consider common ptr as a garbage collection strategy.

I have two questions:

  • When sharing ptr to collect garbage; and when are other strategies like mark-sweep?
  • Is there a lib implemented by shared ptr in C?

Thank.

+3
source share
2 answers

If you want garbage collection in C, look at the Hans Boehm garbage collection .

ptr , : . , smart_ptr .

shared_ptr Boost - ++. C: shared_ptr . , - . ( ++, , shared_ptr .)

.

+3

, :

++

StackOverflow:

scoped_ptr. : shared_ptr vs scoped_ptr

+2

All Articles