track_arc_new

Function track_arc_new 

Source
pub fn track_arc_new<T: ?Sized>(name: &str, value: Arc<T>) -> Arc<T>
Expand description

Track Arc::new allocation.

Records an ArcNew event with the current strong and weak reference counts. Use this when creating a new thread-safe reference-counted pointer.

§Arguments

  • name - A descriptive name for the Arc
  • value - The Arc being tracked (returned unchanged)

§Returns

The input Arc, unchanged.

§Examples

use std::sync::Arc;

let shared = track_arc_new("shared", Arc::new(vec![1, 2, 3]));
assert_eq!(Arc::strong_count(&shared), 1);

let events = get_events();
assert!(events[0].is_arc());