I’m developing an application for MacOS and iOS that repeatedly creates WebInputStream objects to download audio tracks. Even though I am resetting a unique_ptr for each new WebInputStream I noticed my app’s RAM usage growing as new streams were created. I traced this to WebInputStream::createConnection() in juce_Network_mac.mm.
I was able to solve the leakage by enclosing the contents of createConnection() with an @autoreleasepool.
While the connection object looks to be managed appropriately, I am suspicious of the NSMutableURLRequest. Even though the NSMutableURLRequest pointer is passed to URLConnectionState and release called in the respective destructor, something seems to be leaking without the @autoreleasepool. I am no Objective C expert, so I am wondering if my fix is valid and if this is possibly a bug?