facebookexperimental/object-introspection

std::shared_ptr is not implemented for treebuilder v2

JakeHillion opened this issue · 2 comments

Examples:

  • OilIntegration.std_smart_ptr_shared_ptr_uint64_empty
  • OilIntegration.std_smart_ptr_shared_ptr_uint64_present
  • OilIntegration.std_smart_ptr_shared_ptr_vector_empty
  • OilIntegration.std_smart_ptr_shared_ptr_vector_present
  • OilIntegration.std_smart_ptr_shared_ptr_void_empty
  • OilIntegration.std_smart_ptr_shared_ptr_void_present
  • OilIntegration.pointers_incomplete_shared_ptr
  • OilIntegration.pointers_incomplete_shared_ptr_null

This issue is partially resolved by #334, however we don't correctly report the size of the control block.
Let's keep this issue open until then.

Tracking the control block is definitely interesting. As far as I can tell it's impossible to track this efficiently and correctly from the shared pointer interface, unless we kept a reference to every shared pointer and compared every one with every other using owner_before.

Alternatively we could approximate this by calling use_count and attributing some proportion of the control block, rounded down. This might be the fairest way to do it, as really no single shared_ptr should be blamed for the entire control block and really the rounding losses are fine. This would make the size of a shared_ptr feel a bit random though...

It might be worth closing this issue and using #13 to track this instead.