Microsoft MakeCode

PXT flash size when using micro-bit v2

Hi everyone,

When testing program memory usage, i typically edit the pxt-worker.js file found here:

I typically edit this line:

To always throw the error, and provide a bit more info:

It seems that the micro:bit runs at nearly 91% program memory capacity with just the underlying layers programmed to it. So that does not leave a whole lot of room. My expectations were that with the release of V2 and it having double the program memory, that adding my code would not be an issue. However, it does not seem that the pxtworker.js gets the proper information about the available flashsize depending on which version you are using. I tried adding in a V2 only feature such as sound to hopefully trigger something, but no luck. So my question is twofold:

  1. How much extra program memory is now available with V2
  2. Are there any suggestions to increasing program memory for V1? I seem to run out constantly by adding any functions of complexity. Are there any low hanging fruit I could remove from the core or elsewhere to free up space?