You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I looked into getting the instrumentation display in xsbug of free system memory working for Pico. Currently it is just a stub that returns a constant:
The Pico runtime uses newlib for malloc in stdlib. That defines a mallinfo function which returns statistics including what appears to be free space in fordblks:
#include "malloc.h"
....
struct mallinfo info = mallinfo();
return (int32_t)info.fordblks;
Running this in the helloworld example shows that there are 256 bytes free. That doesn't seem correct...
I'm wondering if malloc grows the heap dynamically as needed, in which case some additional calculations are needed. Or, perhaps I've misunderstood mallinfo and fordblks. Perhaps there's a different call that would work here? Anyone with experience on the internals of newlib have a hint?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I looked into getting the instrumentation display in xsbug of free system memory working for Pico. Currently it is just a stub that returns a constant:
moddable/xs/platforms/pico/xsPlatform.c
Lines 678 to 680 in 43bcf83
The Pico runtime uses newlib for malloc in stdlib. That defines a
mallinfo
function which returns statistics including what appears to be free space infordblks
:Running this in the helloworld example shows that there are 256 bytes free. That doesn't seem correct...
I'm wondering if malloc grows the heap dynamically as needed, in which case some additional calculations are needed. Or, perhaps I've misunderstood
mallinfo
andfordblks
. Perhaps there's a different call that would work here? Anyone with experience on the internals of newlib have a hint?Beta Was this translation helpful? Give feedback.
All reactions