- Home /
Full GuiTexture-based user interface memory leak
Hi,
I've made a systeme wich instantiante a whole GUI based on a xml and some png (used as Texture2D) loaded as an input. The GUI is made only with GUIText and GUITexture.
It's working perfectly fine, I can change my whole interface only by editing my xml file. The point is, I want to optimize the size cost of my interface. All the pictures are in ARGB32 and that sucks.
I tryed to create power of 2 textures, load my images into these power of 2 textures, and compress the Texture2D (using like "texture.Compress"). But image lost a lot of quality. Is there anyway to reduce the image memory size ? (they all contain alpha ...). The whole GUI is like ... 280 mo right now (original png files are like 2.75 mo)
Also, I think there is a memory leak. When I run my game in the editor with a memory consumption of 200 mo, after the interface is created if I stop my game, the memory of the editor is aroud 350. After 4hours of work, it's like 1.4 go ... It's not always increasing with the same amount, but it's increasing. I guess it's my fault. So I was wondering if there is a tool (like the Profiler) wich is able to list the texture currently in RAM (maybe I'm dreaming ^_^)
It sounds like, as far as your textures go, that you need to rework them completely. There really isn't a way to reduce the runtime file size of an ARGB32 texture, the only thing you can do to shrink the file size is to go to a lower color channel setting. Also, having individual images for all your GUITextures ins$$anonymous$$d of using a GUI system that you can atlas textures with is inefficient as far as file size goes. To get the lowest package size and video memory consumption, you need to look into not using GUITextures and go with a GUI system of sorts, plenty of which are available on the asset store. Prime31 has also created a free plug-in, but be warned, it is very code intensive to make complex menu systems.
Answer by Panda313 · Feb 13, 2012 at 11:00 PM
Thanks !
Actually, I have a big texture that containt all my elements. Then I split it into small textures and I destroy the big one. (I do that because the big picture is made with a php script that is not really efficiant so there is a lot of transparent spaces that might cost a lot in memory). Do you think that I should keep my big texture in memory instead of spliting it ?
I'll take a deep look into the GUI systems you talked about !
Thanks again !
Your answer
![](https://koobas.hobune.stream/wayback/20220613064039im_/https://answers.unity.com/themes/thub/images/avi.jpg)