Malloc pool failures with arrays

I have a program that used to work with 2.2.0 simulator with and without malloc pool enabled, and also works on the actual device. With the 2.3.0 simulator, the simulator fails with "not enough memory" on an import line. The file I am trying to import contains many large arrays and apparently the 2.3.0 simulator didn't like it.

I have replicated what I am doing in this simplified project:

memory_test.zip (1.3 MB)

You can see that main.lua tries to import data.lua, which contains a large_array of 437206 elements. Simulator loads fine if the array contains just 437205 elements instead. My actual project contains more than 720000 elements total so I am way over that limit, but it used to work in 2.2.0. I am wondering if there are some new limits that are being enforced?

The game works on the actual device running 2.3.0.

I would suggest stepping in the debugger with the Malloc Log window open and watch memory usage. On the Mac Sim you're at 15.87 MB. Without looking, my guess is the way Windows allocs memory is slightly different so you're going over in the Windows Sim.

I have updated the test to more closely match what I was doing:

memory_test2.zip (2.4 MB)

This does not run on the simulator with malloc pool enabled, but does run on the actual device. I am going to guess that I am right at the edge of memory limits, and the discrepancy between simulator and device is due to differences in implementation details.

I guess I will load the data incrementally instead of baking them into the pdz.

There will be a 32 to 64 bit addressing difference so the Sim will use slightly more memory. I am currently looking in to this a bit more to make sure there isn't an issue on our end.