Search Issue Tracker

By Design

Votes

2

Found in

2018.4

2019.4.7f1

2020.2

Issue ID

1272020

Regression

No

[iOS] UnityWebRequest POST request does not close and results in memory leak

WebRequest

-

How to reproduce:
1. Open the attached 'SamplePostRequestBR.zip' project
2. Build for iOS and open the Xcode project
3. Deploy Xcode project to iOS device
4. Press 'Start Requests' button
5. Inspect memory growth in Debug navigator

Expected result: Memory increases and causes memory leak
Actual result: Memory remains the same

Reproducible with: 2018.4.26f1, 2019.4.9f1, 2020.1.3f1, 2020.2.0a21

Reproducible with:
iPhone 8+ (iOS 12.0)
iPhone XR (iOS 13.4.1)
iPad 9.7 6th gen (iOS 12.1)
iPad Air 2 (iOS 13)
iPhone 7 (iOS 13)
iPhone 5s (iOS 12)

Notes:
- Most of the times it happens in the first attempt, but if after 10 minutes you don't see the memory growing, stop everything, clean the Unity project (remove Xcode project and Library folder) and start over, this shouldn't take more than a couple of attempts
- Screenshots of the issue are attached in Edit

  1. Resolution Note (2020.2.X):

    Only a superficial investigation was done, please reopen in case the issue can be reproduced after fixing the notes below:
    - After a quick search in code I don't see UnityWebRequest objects being disposed nor placed inside using block. This means that the project relies on Garbage Collector entirely, which would explain the intermittence of the issue. Given that majority of memory used by UWR is native memory, the GC might not kick in (since it's still plenty of free managed memory).
    - A repro project uses awaiters and async tasks, overcomplicating the things. Could a simple project that uses UWR in coroutines and proper disposes be made? If so, check the memory consumption in it, reopen if a leak still can be observed.

Comments (2)

  1. Ruslank100

    Aug 22, 2020 11:08

    There should be a way to report these bots

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.