okta-oidc-ios icon indicating copy to clipboard operation
okta-oidc-ios copied to clipboard

URLSession leak

Open rickbdotcom opened this issue 1 month ago • 2 comments

Describe the bug?

Okta framework is showing memory leaks when run in debug memory graph. Appears to be caused by not invalidating the session after use.

https://lapcatsoftware.com/articles/NSURLSession.html

What is expected to happen?

Framework should not leak memory.

What is the actual behavior?

URLSession is leaking.

Reproduction Steps?

Initialize OktaOidcStateManager and observe memory leaks in Debug Memory Graph. All the reported leaks in this screenshot appear to be from the URLSession allocated in OktaOidcConfig.setupURLSession

Image

Additional Information?

No response

SDK Version(s)

3.11.2

Build Information

No response

rickbdotcom avatar Nov 07 '25 16:11 rickbdotcom

Thank you for submitting this @rickbdotcom. I would suggest you look into the new Okta Client SDK at okta-mobile-swift which replaces this legacy OIDC SDK. For more information, you can see the blog post announcing the modern authentication SDK.

AlexNachbaur avatar Nov 07 '25 17:11 AlexNachbaur

Oh thank you! I was just running memory leak testing on our application and this was the current version of the SDK we were using. I will upgrade and see if that fixes the issue. Thanks!

rickbdotcom avatar Nov 07 '25 18:11 rickbdotcom