How would you debug a subtle memory leak or data race in a high-frequency, multithreaded environment?