Skip to content

Who drops all the Arcs ? #10065

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
matklad opened this issue Aug 28, 2021 · 2 comments · Fixed by #10069
Closed

Who drops all the Arcs ? #10065

matklad opened this issue Aug 28, 2021 · 2 comments · Fixed by #10069

Comments

@matklad
Copy link
Member

matklad commented Aug 28, 2021

Running cargo llvm-lines --lib --release -p ide_ssr | head -n 24 gives extremely curious results:

 Lines          Copies        Function name
  -----          ------        -------------
  533069 (100%)  28309 (100%)  (TOTAL)
   20349 (3.8%)    357 (1.3%)  alloc::raw_vec::RawVec<T,A>::current_memory
   18324 (3.4%)    332 (1.2%)  <alloc::sync::Weak<T> as core::ops::drop::Drop>::drop
   14024 (2.6%)    332 (1.2%)  alloc::sync::Weak<T>::inner
   11718 (2.2%)    378 (1.3%)  core::ptr::metadata::from_raw_parts_mut
   10710 (2.0%)    357 (1.3%)  <alloc::raw_vec::RawVec<T,A> as core::ops::drop::Drop>::drop
    7984 (1.5%)    332 (1.2%)  <alloc::sync::Arc<T> as core::ops::drop::Drop>::drop
    7968 (1.5%)    332 (1.2%)  core::alloc::layout::Layout::for_value_raw
    6790 (1.3%)     97 (0.3%)  hashbrown::raw::RawTable<T,A>::drop_elements
    6596 (1.2%)     97 (0.3%)  <hashbrown::raw::RawIterRange<T> as core::iter::traits::iterator::Iterator>::next
    6240 (1.2%)     60 (0.2%)  salsa::blocking_future::Promise<T>::transition
    6100 (1.1%)     48 (0.2%)  core::iter::traits::iterator::Iterator::try_fold
    5454 (1.0%)     31 (0.1%)  hashbrown::raw::RawTable<T,A>::resize
    5029 (0.9%)    332 (1.2%)  alloc::sync::Arc<T>::drop_slow
    4624 (0.9%)     34 (0.1%)  alloc::raw_vec::RawVec<T,A>::grow_amortized
    4122 (0.8%)    458 (1.6%)  core::mem::align_of
    3890 (0.7%)    357 (1.3%)  <alloc::vec::Vec<T,A> as core::ops::drop::Drop>::drop
    3852 (0.7%)     37 (0.1%)  hashbrown::raw::RawTable<T,A>::find
    3668 (0.7%)     89 (0.3%)  <core::result::Result<T,E> as core::ops::try_trait::Try>::branch
    3415 (0.6%)     17 (0.1%)  hashbrown::raw::RawTable<T,A>::rehash_in_place
    3408 (0.6%)     24 (0.1%)  alloc::raw_vec::RawVec<T,A>::allocate_in
    3402 (0.6%)    378 (1.3%)  core::ptr::slice_from_raw_parts_mut

Seems like something causes us to generate more than three hundreds (!!!) instantiations of Arc::drop.

@bjorn3
Copy link
Member

bjorn3 commented Aug 28, 2021

Try compiling with -Zsymbol-mangling-version=v0. That should make the symbol names include the exact generic parameters they are instantiated with.

@matklad
Copy link
Member Author

matklad commented Aug 28, 2021

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants