Forums | developer.brewmp.com Forums | developer.brewmp.com

Developer

Forums

Forums:

Hey,
I'm trying to animate series of images (PNG format) received from a remote server. The thing is that calling ISHELL_CreateInstance for the IImage* sporadically returns ENOMEMORY, and I'm not sure why, since the available memory at that point is ~45%. Is there a specific issue regarding allocationg IImage instances? I've noticed that in most of the code examples the IImage is allocated by ISHELL_LoadResImage or ISHELL_LoadImage (from files) and not by ISHELL_CreateInstance. Any insight?

Thanks, Yigal

Are you checking total free memory, or largest free memory block allocatable?

Are you checking total free memory, or largest free memory block allocatable?

I'm checking the total free memory, by subtracting the used memory (IHEAP_GetMemStats) from the total memory (ISHELL_GetDeviceInfo).
To sharpen the point, the problem is definitely with the instantiation of IImage with AEECLSID_PNG. Everything is cool with AEECLSID_JPEG. 2.1 emulator fails with the PNG instantiation, while 3.1 simulator succeeds. Moto V3C fails. Again, looking for insights...
Thanks, Yigal

I'm checking the total free memory, by subtracting the used memory (IHEAP_GetMemStats) from the total memory (ISHELL_GetDeviceInfo).
To sharpen the point, the problem is definitely with the instantiation of IImage with AEECLSID_PNG. Everything is cool with AEECLSID_JPEG. 2.1 emulator fails with the PNG instantiation, while 3.1 simulator succeeds. Moto V3C fails. Again, looking for insights...
Thanks, Yigal

checking free heap isn't enough, since if its split equally in two or worse, you'll have less than half the memory you think you do, you have to check largest available too, seems unlikely its memory related unless the heap is truely fragmented though, still worth a check to eliminate it.
pdwTotal is total heap, pdwMax is maxium allocatable in one block.
uint32 GETRAMFREE(uint32 *pdwTotal, uint32 *pdwMax)
it might just be an issue with PNG support though, it varies device to device

checking free heap isn't enough, since if its split equally in two or worse, you'll have less than half the memory you think you do, you have to check largest available too, seems unlikely its memory related unless the heap is truely fragmented though, still worth a check to eliminate it.
pdwTotal is total heap, pdwMax is maxium allocatable in one block.
uint32 GETRAMFREE(uint32 *pdwTotal, uint32 *pdwMax)
it might just be an issue with PNG support though, it varies device to device