I think we need a bit more information to be able to help here.
I'm not aware of a Leaks.app. Are you using the leaks
command line tool or the Leaks instrument in the Instruments application?
Are you able to attach a screenshot of what you are seeing, or maybe a memgraph that captured the leak?
What is the type of the object that's being leaked, and is it leaked by itself or as part of a bigger reference cycle?
Is it something you can easily reproduce in a small example project?
As an aside: Using sleep
to avoid a race condition is usually not a good idea. In most cases it only makes the race condition less likely to occur but doesn't actually solve it and it's hard to guess whether it will actually make it less or more likely for your customers.
Instead, look into using concurrency tools like locks, dispatch queues, or Swift Concurrency to prevent the race condition.