Hacker News new | ask | show | jobs
Possibly memory leak in macOS network request stack
5 points by telcy 1902 days ago
I have written an application for macOS that is dealing with 50-100 network requests per second and the memory is constantly growing (reaching 1gb per day). The first version was in Swift, so I believed it was a Swift related issue and reported it here https://bugs.swift.org/browse/SR-14194. Then I decided to rewrite my application in Rust and surprisingly had the same memory issue. Same code runs fine on Linux.

Example in Rust: https://gist.github.com/telcy/b1c3a444def65dd0f1d109b6a98db0f1

Usually I try to find the issue at my end, but this seems to be out of my control. It is a bit mind boggling for me how a crucial part of an operating system leaks memory without anyone noticing.

I hope this gets some attention (and discussion) as this would mean most applications on macOS with network requests do leak memory to some extent.

1 comments

NSURL and its kin are notoriously leaky. I've found a couple of leaks myself.

The best you can do is write the most concise example in an officially-supported language and file a Feedback.

It took about a year and a half or sofor both of my NSURL (one was pretty severe) leaks to be fixed, but this was years ago. Good luck.

Thanks, I have already filled a feedback for it and hope that someone will take some serious look into it.