Profiling the Image Heap

Dear MicroEJ,

I’m currently facing the MicroUI error nb 3 ( Not enough memory to allocate the Image’s buffer ). According to the developer’s guide I need to Try to remove references on useless images and retry to open the new image or increase the size of the MicroUI working buffer. but I don’t want to increase the Image heap size blindly. I’m more interested in discovering dynamically the bytes allocated for the memory.

Is there a way to retrieve at runtime the real allocated memory reserved for the MicroUI ?

Regards,

Jean-Baptiste W.

Hi @jeanBaptiste,

Currently, there is no proper way to have this information. You can get an idea of the used memory using an internal debug info:
If you are using a MicroUI pack 11.X

  • In your project, in a properties.list file, add the property com.is2t.microui.log=true

This will print the object in the MicroUI Image Heap:

[MicroUI LOG: add native object]	Image:	nativeID = 7	480*249
[MicroUI LOG: available native object]
	Image:	nativeID = 7	480*249
	Image from identifier:	nativeID = 6	66*71	format = 8	/images/pot_large_icon.png
	Image from identifier:	nativeID = 5	68*76	format = 8	/images/mug_large_icon.png
	Image from identifier:	nativeID = 4	11*13	format = 8	/images/coffee_bean_icon.png
	Image from identifier:	nativeID = 3	10*13	format = 8	/images/water_tank_icon.png
	Image from identifier:	nativeID = 2	20*14	format = 8	/images/wifi_icon.png
	Image from identifier:	nativeID = 1	14*14	format = 8	/images/settings_icon.png

Using that you should be able to compute the overall memory usage for the raw data. You will still need to add a bit more for the header size.

Regards,