Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory Optimized approach to generate mipmaps and enable compression #1

Open
tarunkrishnat0 opened this issue Apr 27, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@tarunkrishnat0
Copy link

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)?

@IvanMurzak IvanMurzak added the enhancement New feature or request label Aug 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants