fix some dependencies
Fix segfault in retainer profiling when using multiple cores (#5909)

Thanks to @akio on the ticket for the diagnosis and the patch.  I
modified the comments a bit.