373 views
in System Integration by
Good day,

I'm using EW 8.30 on the STM32F469 device

Perhaps I am not understanding the EW documentation correctly. I've run out of RAM despite images being freed up, so I set up a test:

[1] I instrumented the EW calls to alloc and free RAM (EwAlloc and EwFree) with a (unit tested) list whihc keeps track of allocations and deallocations. When EwAlloc is called, the pointer and size are added to the list. When EwFree is called, the pointer is matched to the record in the list, and that record is removed from the list. This allows me to track RAM that EW has asked for, but not freed

[2] I created about 25 ExternBitmaps, and assigned to each an Image object. The image object .Name is set, and it loads and displays fine

[3] At this point, I stop the debugger, and save the pointer list

[4] Then I run it again, and with a user command, I create an event which sets .Name for each of the 39 images to "". The behaviour is as expected, and all of the images disappear from the UI, and do not return. (That's expected)

[5] Then I wait 5 minutes to ensure that the garbage collector takes action, although I know that the EW engine is supposed to run the garbage collecter every 10 seconds. I call EwReclaimMemory as well

[6] At this point, I stop the debugger again, and save the pointer list

[7] I pull the 2x files into Excel, and compare

[8] I find that the bitmap memory has not been freed up, even though I set .Name to "", and the images have disappeared from the screen. (The bitmap files occupy > 5k)

I have listed the before and after pointer lists for you as comments:

Kind Regards,

Rob
by

COL [A]     |COL [B] |COL [C] 
ADDR        |SIZE    |SIZE    
-----------------------------
0xC00BC478  |1024    |1024    
0xC00BC87C  |1024    |1024    
0xC00BCC80  |128     |128     
0xC00BCD04  |52      |52      
0xC00BCD3C  |262180  |262180  
0xC00FCD64  |64      |64      
0xC00FCDA8  |52      |52      
0xC00FCDE0  |7774    |7774    
0xC00FEC44  |1076    |1076    
0xC00FF094  |12      |12      
0xC00FF0A4  |464     |464     
0xC00FF278  |12      |12      
0xC00FF288  |36      |36      
0xC00FF2B0  |24      |24      
0xC00FF2CC  |12      |12      
0xC00FF2DC  |164     |164     
0xC00FF384  |12      |12      
0xC00FF394  |36      |36      
0xC00FF3BC  |12      |12      
0xC00FF3CC  |328     |328     
0xC00FF530  |24      |24      
0xC00FF54C  |24      |24      
0xC00FF568  |476     |476     
0xC00FF7E8  |52      |52      
0xC00FF820  |10036   |10036   
0xC0101F58  |15610   |15610   
0xC0105C58  |28      |28      
0xC0105C78  |30      |30      
0xC0105CAC  |24      |24      
0xC0105CC8  |62      |62      
0xC0105D58  |60      |60      
0xC0105D98  |48      |48      
0xC0105DCC  |-       |20      
0xC0105DE4  |476     |476     
0xC0105FDC  |28      |28      
0xC0105FFC  |30      |30      
0xC0106030  |24      |24      
0xC010604C  |58      |58      
0xC010608C  |66      |66      
0xC01060D8  |56      |56      
0xC0106114  |48      |48      
0xC0106160  |476     |476     
0xC0106358  |28      |28      
0xC0106378  |30      |30      
0xC01063AC  |24      |24      
0xC01063C8  |50      |50      
0xC010644C  |48      |48      
0xC0106480  |48      |48      
0xC01064CC  |476     |476     
0xC01066C4  |28      |28      
0xC0106718  |24      |24      
0xC0106734  |60      |60      
0xC01067C0  |58      |58      
0xC0106800  |48      |48      
0xC010684C  |476     |476     
0xC0106A44  |28      |28      
0xC0106A64  |48      |48      
0xC0106A98  |24      |24      
0xC0106AB4  |66      |66      
0xC0106B48  |64      |64      
0xC0106B8C  |48      |48      
0xC0106BD8  |1048    |1048    
0xC010700C  |44      |44      
0xC010703C  |16      |16      
0xC0107050  |64      |64      
0xC0107094  |52      |52      
0xC01070CC  |65572   |65572   
0xC011710C  |92      |92      
0xC011716C  |64      |-       
0xC01171B4  |36      |-       
0xC01171E4  |24      |24      
0xC0117200  |24      |24      
0xC011721C  |24      |24      
0xC0117238  |24      |24      
0xC0117254  |36      |36      
0xC011727C  |16      |16      
0xC0117290  |24      |24      
0xC01172AC  |36      |36      
0xC01172D4  |16      |16      
0xC01172E8  |24      |24      
0xC0117304  |24      |24      
0xC0117320  |476     |476     
0xC0117518  |28      |28      
0xC0117538  |48      |48      
0xC011756C  |24      |24      
0xC0117588  |38      |38      
0xC01175B4  |48      |48      
0xC0117600  |476     |476     
0xC01177F8  |28      |28      
0xC0117818  |48      |48      
0xC011784C  |24      |24      
0xC0117868  |52      |52      
0xC01178A0  |48      |48      
0xC01178EC  |476     |476     
0xC0117AE4  |28      |28      
0xC0117B04  |48      |48      
0xC0117B38  |24      |24      
0xC0117B54  |44      |44      
0xC0117B84  |48      |48      
0xC0117BD0  |476     |476     
0xC0117DC8  |28      |28      
0xC0117DE8  |48      |48      
0xC0117E1C  |24      |24      
0xC0117E38  |38      |38      
0xC0117E64  |48      |48      
0xC0117EB0  |476     |476     
0xC01180A8  |28      |28      
0xC01180C8  |48      |48      
0xC01180FC  |24      |24      
0xC0118118  |42      |42      
0xC0118148  |48      |48      
0xC0118194  |476     |476     
0xC011838C  |28      |28      
0xC01183AC  |48      |48      
0xC01183E0  |24      |24      
0xC01183FC  |58      |58      
0xC011843C  |48      |48      
0xC0118488  |476     |476     
0xC0118680  |28      |28      
0xC01186A0  |48      |48      
0xC01186D4  |24      |24      
0xC01186F0  |58      |58      
0xC0118730  |48      |48      
0xC011877C  |476     |476     
0xC0118974  |28      |28      
0xC0118994  |48      |48      
0xC01189C8  |24      |24      
0xC01189E4  |36      |36      
0xC0118A0C  |48      |48      
0xC0118A58  |476     |476     
0xC0118C50  |28      |28      
0xC0118CA4  |24      |24      
0xC0118CC0  |46      |46      
0xC0118CF4  |48      |48      
0xC0118D40  |456     |456     
0xC0118F24  |24      |24      
0xC0118F40  |24      |24      
0xC0118F5C  |24      |24      
0xC0118F78  |104     |104     
0xC0118FFC  |104     |104     
0xC0119080  |104     |104     
0xC0119104  |104     |104     
0xC0119188  |104     |104     
0xC011920C  |476     |476     
0xC0119404  |28      |28      
0xC0119424  |-       |36      
0xC0119458  |24      |24      
0xC0119474  |36      |36      
0xC01194E8  |34      |34      
0xC0119510  |48      |48      
0xC011955C  |476     |476     
0xC0119754  |28      |28      
0xC0119774  |-       |48      

 

by

0xC01197A8  |24      |24      
0xC01197C4  |34      |34      
0xC0119838  |32      |32      
0xC011985C  |48      |48      
0xC01198A8  |476     |476     
0xC0119AA0  |28      |28      
0xC0119AC0  |-       |48      
0xC0119AF4  |24      |24      
0xC0119B10  |40      |40      
0xC0119B88  |38      |38      
0xC0119BB4  |48      |48      
0xC0119C00  |476     |476     
0xC0119DF8  |28      |28      
0xC0119E18  |-       |48      
0xC0119E4C  |24      |24      
0xC0119E68  |36      |36      
0xC0119EDC  |34      |34      
0xC0119F04  |48      |48      
0xC0119F50  |476     |476     
0xC011A148  |28      |28      
0xC011A19C  |24      |24      
0xC011A1B8  |38      |38      
0xC011A230  |36      |36      
0xC011A258  |48      |48      
0xC011A2A4  |476     |476     
0xC011A49C  |28      |28      
0xC011A4F0  |24      |24      
0xC011A50C  |46      |46      
0xC011A58C  |44      |44      
0xC011A5BC  |48      |48      
0xC011A608  |476     |476     
0xC011A800  |48      |48      
0xC011A868  |24      |24      
0xC011A884  |46      |46      
0xC011A904  |44      |44      
0xC011A934  |48      |48      
0xC011A980  |476     |476     
0xC011AB78  |52      |52      
0xC011ABE4  |24      |24      
0xC011AC00  |50      |50      
0xC011AC84  |48      |48      
0xC011ACB8  |48      |48      
0xC011AD04  |476     |476     
0xC011AEFC  |52      |52      
0xC011AF68  |24      |24      
0xC011AF84  |50      |50      
0xC011B008  |48      |48      
0xC011B03C  |48      |48      
0xC011B088  |476     |476     
0xC011B280  |28      |28      
0xC011B2D4  |24      |24      
0xC011B2F0  |30      |30      
0xC011B360  |28      |28      
0xC011B380  |48      |48      
0xC011B508  |52      |52      
0xC011B540  |45588   |45588   
0xC012679C  |52      |52      
0xC01267D4  |45588   |45588   
0xC01319EC  |64      |-       
0xC0131A30  |52      |52      
0xC0131A68  |45588   |45588   
0xC013CCC4  |52      |52      
0xC013CCFC  |45588   |45588   
0xC0147F14  |64      |-       
0xC0147F58  |52      |52      
0xC0147F90  |45588   |45588   
0xC01531EC  |52      |52      
0xC0153224  |45588   |45588   
0xC015E43C  |64      |-       
0xC015E480  |52      |52      
0xC015E4B8  |45588   |45588   
0xC0169714  |52      |52      
0xC016974C  |45588   |45588   
0xC0174964  |64      |-       
0xC01749A8  |52      |52      
0xC01749E0  |45588   |45588   
0xC017FBF8  |52      |52      
0xC017FC30  |12932   |12932   
0xC0182EB8  |64      |-       
0xC0182EFC  |52      |52      
0xC0182F34  |12308   |12308   
0xC0185F4C  |64      |-       
0xC0185F90  |52      |52      
0xC0185FC8  |9188    |9188    
0xC01883B0  |64      |-       
0xC01883F4  |52      |52      
0xC018842C  |7940    |7940    
0xC018A334  |64      |-       
0xC018A378  |52      |52      
0xC018A3B0  |11060   |11060   
0xC018CEE8  |64      |-       
0xC018CF2C  |52      |52      
0xC018CF64  |7940    |7940    
0xC018EE6C  |64      |-       
0xC018EEB0  |52      |52      
0xC018EEE8  |11060   |11060   
0xC0191A20  |64      |-       
0xC0191A64  |52      |52      
0xC0191A9C  |10644   |10644   
0xC0194434  |64      |-       
0xC0194478  |52      |52      
0xC01944B0  |11060   |11060   
0xC019702C  |52      |52      
0xC0197064  |93672   |93672   
0xC01ADE50  |64      |-       
0xC01ADE94  |52      |52      
0xC01ADECC  |93672   |93672   
0xC01C4CFC  |52      |52      
0xC01C4D34  |93672   |93672   
0xC01DBB20  |64      |-       
0xC01DBB64  |52      |52      
0xC01DBB9C  |93672   |93672   
0xC01F29CC  |52      |52      
0xC01F2A04  |93672   |93672   
0xC02097F0  |64      |-       
0xC0209834  |52      |52      
0xC020986C  |93672   |93672   
0xC022069C  |52      |52      
0xC02206D4  |93672   |93672   
0xC02374C0  |64      |-       
0xC0237504  |52      |52      
0xC023753C  |93672   |93672   
0xC024E36C  |52      |52      
0xC024E3A4  |93672   |93672   
0xC0265190  |64      |-       
0xC02651D4  |52      |52      
0xC026520C  |93672   |93672   
0xC027C03C  |52      |52      
0xC027C074  |93672   |93672   
0xC0292E60  |64      |-       
0xC0292EA4  |52      |52      
0xC0292EDC  |93672   |93672   
0xC02A9D0C  |52      |52      
0xC02A9D44  |93672   |93672   
0xC02C0B30  |64      |-       
0xC02C0B74  |52      |52      
0xC02C0BAC  |93672   |93672   
0xC02D79DC  |52      |52      
0xC02D7A14  |93672   |93672   
0xC02EE800  |64      |-       
0xC02EE844  |52      |52      
0xC02EE87C  |93672   |93672   
0xC03056AC  |52      |52      
0xC03056E4  |93672   |93672   
0xC031C4D0  |64      |-       
0xC031C514  |52      |52      
0xC031C54C  |93672   |93672   
0xC033337C  |52      |52      
0xC03333B4  |93672   |93672   
0xC034A1A0  |64      |-       
0xC034A1E4  |52      |52      
0xC034A21C  |93672   |93672   
0xC0361008  |64      |-       
0xC036104C  |52      |52      
0xC0361084  |45588   |45588   
0xC036C2E4  |48      |48      
0xC036C318  |48      |48      
0xC036C34C  |66      |66      
0xC036C394  |48      |48      
0xC036C3C8  |48      |48      
0xC036C604  |268     |268     
0xC036C714  |88      |88      
0xC036CD88  |56      |56      
0xC036CDC4  |56      |56      
0xC036CE00  |56      |56      
0xC036CE3C  |56      |56      
0xC036CE78  |56      |56      
0xC036CF94  |6944    |6944

1 Answer

0 votes
by

Hi Rob,

maybe a few ideas (without analyzing your dump files):

1.) The Garbage Collector is running every 10 seconds only within the Prototyper! On the target EwReclaimMemory is called after each update.

2.) Bitmaps are typically kept within the memory (so called surface cache) in order to reduce the necessity to load and decompress images again and again. This means, if you want to make a proper measurement, you need to set the size of the surface cache to 0. Then it will be ensured that all bitmap resources are freed immediatley when they are no more accessible.

Just change the setting within your makefile:

-DEW_MAX_SURFACE_CACHE_SIZE=0

3.) In order to get a proper memory statistic, maybe the memory profiling feature is helpful.

Best regards,

Manfred

by
Thank you Manfred, that setting sorted me out, much, MUCH appreciated :-D

Kind Regards,

Rob

Embedded Wizard Website | Privacy Policy | Imprint

...