Search Issue Tracker

Fixed in 5.3.7

Votes

23

Found in

5.3.0f4

Issue ID

765799

Regression

No

Destroying Texture2D doesn't free memory

Profiling

-

Steps to reproduce:

1. Open attached project "765799.zip"
2. Open scene "repro"
3. Open "TestMemoryLeak.cs"
4. Notice that it creates new Texture2D every second. Then destroys it.
5. Run scene
6. Open task manager and notice how memory builds up

Note: This issue is only partially visible in the profiler: "Used Total" doesn't increase when memory builds up, only "Total System Memory Usage" builds up.

Reproduced with: 5.1.4f1, 5.2.4p1, 5.3.2p1, 5.4.0b4

Comments (9)

  1. softone

    Jul 02, 2019 22:29

    It seems this can be still reproduced with 2019.1.8f1.

    When inspected with Memory Profiler, tens of old allocations could be found from memory, and if continued would eventually kill player or editor on any platform.

    And a call to Resources.UnloadUnusedAssets() still fixes this.

  2. bansheesoft

    Sep 06, 2017 15:29

    "For my case, calling that helped: Resources.UnloadUnusedAssets();"

    Also worked for me thanks XLUNCHBOXXX. I was just converting screen grabs to JPGs using textures. They never were release it seemed until I called the above.

  3. xLunchboxxx

    Jun 28, 2016 17:06

    For my case, calling that helped: Resources.UnloadUnusedAssets();

  4. jp_topps

    Jun 16, 2016 14:27

    I should mention that I am on 5.3.4f1 - and the device I am testing on is presently iOS. The leaks I am seeing are around 70MB for 4 textures being created and explicitly destroyed.

  5. jp_topps

    Jun 16, 2016 14:26

    I am running into this exact situation, but cannot reproduce the leak in Editor. When running on device, however, I can see the Mono heap grow on each iteration, even though the number of textures and amount of texture memory reported in the profiler remains consistent.

  6. zealousweb

    May 19, 2016 13:01

    Same issue is faced while internet connection lost while downloading videos. Both in Android & iOS

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.