Scripting: Unable to allocate memory

Hello, i’m getting this error when i try to “run my script”:

Scripting: Unable to allocate mamory

here are my specs:
Pixhawk 2.4.8
MissionPlanner 1.3.80

SCR_ENABLE = 1
SCR_HEAP_SIZE = 44032 (already tried 524288, 64000, 1049000)

my script:

gcs:send_text(6, string.format("[SCRIPT] Hello World!!!"))

Hello @Hanzenn welcome to the ArduPilot community,

If you have a Pixhwak with a 1MB bug, you will not be able to run lua scripting.
Do you have a 1MB limited Pixhawk board?

I dont know, my coworkers bought this Pixhawk unit. Is there a way that i can check it using Mission Planner?

Go to MP’s setup >> install screen, then plug in the USB cable to the autopilot and check the status message that appears just below the grey/green progress bar. It should display, “Found board type 9 brdrev 0 blrev 4 fwmax: xxxxx chip xxxx” if the “fwmax” number starts with “2” (e.g. “2080768”) then the board is fine. If it starts with “1” then it has the 1MB flash limit.

Credits go to @rmackay9

The Pixhawk 2.x boards are all F4s though so I think you won’t realistically be able to run scripts on it. Sorry for the bad news. Perhaps we could make the wiki more clear although it does talk about needing a “High powered autopilot”.

2 Likes

I used to nicely run scripts on a F427-based Pixracer. Has anything changed recently about memory consumption of the scripting engine?

Reduce SCR_HEAP_SIZE and you may get results. F4 boards don’t have much room left these days with added features over time. If you want to do anything meaningful with scripting, it’s probably time to move to H7 boards.