RAM and Code size


I’ve searched the documentation to find the actual RAM size on the M1306B and how I can the determine the memory usage. I’ve used the wm_osGetRamInfo, but its unclear in the documentation the returned values actually represent.

According to the documentation, this function returns:

// Memory information structure
typedef struct
u32 TotalSize; // Total RAM size
u32 StackSize; // Call stacks size
u32 HeapSize; // Heap memory size
u32 GlobalSize; // Global variables size
} wm_osRamInfo_t;

The problem is, what does it actually say. Eg. if you subtract

Total size - (heap+stack+global) = 0

This should indicate that my memory consumption+plus available memory is represented, but which values represent what?

If I add a large global buffer (eg 2000 bytes) the heap size is increased by 2000 bytes while the stack size is decreased with 2000 bytes.

Does this mean that the heap size is my memory consumption, and that the stack size is available memory.

All I want to know is my memory consumption (code size + allocated memory) and available space.

Anybody enllight me please.


Maybe you should take a look to the file m which will contain the memory list of your application. Here you can find how much static memory is used by your application. Further I’ve seen an example how to calculate the available memory anywhere here in the forum.

Hope it helps, ralf