Skip to content

Memory Optimized approach to generate mipmaps and enable compression #1

Description

@tarunkrishnat0

Hi ,

This project looks very well written - Thanks for making it open source.

I'm trying to extend your repo with option to generate mipmaps and enable compression on the downloaded texture, so as to reduce the memory usage even with mipmaps enabled. However, I observed few things that are not as per Unity's documentation, details are mentioned below. Would be great if you can help out.


For generating mipmaps and enabling compression, using DownloadHandlerBuffer is resulting in (>50%) less Memory usage and GC than the recommended DownloadHandlerTexture.

Stats
Note: The above logs are in reverse order to what is usually seen in Unity Editor - top to bottom means most recent to oldest.

But as per documentation:

Finally, DownloadHandlerTexture only allocates managed memory when finally creating the Texture itself, which eliminates the garbage collection overhead associated with performing the byte-to-texture conversion in script.​

Here are the codes for both the methods:

Any thoughts on why this could be happening, mainly the GC aspect?
Also will there be any side effects(in terms of CPU usage, ..) with this approach(using DownloadHandlerBuffer)?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions