How to know how much memory used, or left after creating a micropython program?

After creating micropython program and flashing the digi module with it, how do you see how much memory was used, and what is left?


In my opinion, this reference below will help you,

import gc

I see the article and it has some useful things, but all I am kind of looking for is if i create a micropython program, how big is the program in bytes either kilo, or mega…and knowing what will fit in the module


“After creating a MicroPython program, you can check the memory usage by utilizing the gc module. Use the gc.mem_alloc() function to retrieve the amount of memory currently allocated, and gc.mem_free() to get the free memory remaining. These functions provide insights into memory usage, helping you optimize your MicroPython program for efficient resource utilization.”

1 Like