b. Freeing Up Memory

<< Click to Display Table of Contents >>

Navigation:  Tutorials > Tutorial 19 - Miscellaneous Commands >

b. Freeing Up Memory

This section shows how to use the Free() command to release the resources (such as bitmaps, files) after using them to free up the memory.



Command Prototype


uint16_t Free(int16_t Handle)





Value received from LoadImageFile() command






void setup()


/* Initialize CleO - needs to be done only once */



/* Start building a screen frame */




/* Get the handle for bitmap file */

 int16_t hJPEG = CleO.LoadImageFile("@Pictures/ctg.jpg", 0);


/* Draw a bitmap at (400, 240) using hJPEG handle */

 CleO.Bitmap(hJPEG, 400, 240);


/* Display completed screen frame */



/* Free bitmap handle */




void loop()







In the above code snippet, the Setup routine loads and draws the bitmap file. After using the resource (i.e. bitmap files), the Free() command is used to release the allocated resources using the bitmap handle. Use the @ symbol only when performing the file operation from the eFlash and not from the SD Card.