Getting error "Cannot enlarge memory arrays" on HTML5 build (SOLVED)

After html5 build my game not loading and it displays the following errors.

please help me to solve this issue.

2 Likes

I would start by increasing the Custom Heap Size setting in game.project.

2 Likes

I would also take a look at the build report and profiler stats (when running a local non-html5 build) to see what kind of size you have for your assets. Do you have several very large textures maybe?

2 Likes

thank you @britzl. after reducing images file size problem solved

3 Likes

@britzl. after adding some images i have faced this issue again and after that i have change [Custom Heap Size settings.
after that this error occurs.

“exception thrown: RuntimeError: memory access out of bounds,RuntimeError: memory access out of bounds”

please help me

this is my project file

[project]
title = Monkey Shooter
dependencies = https://github.com/defold/extension-fbinstant/archive/master.zip
bundle_resources = /bundle_resources
bundle_exclude_resources = /deploy

[bootstrap]
main_collection = /main/main.collectionc

[input]
game_binding = /input/game.input_bindingc
use_accelerometer = 0

[display]
width = 640
height = 1136

[ios]
app_icon_120x120 = /assets/app_icons/icon_120.png
app_icon_180x180 = /assets/app_icons/icon_180.png
app_icon_76x76 = /assets/app_icons/icon_76.png
app_icon_152x152 = /assets/app_icons/icon_152.png
app_icon_57x57 = /assets/app_icons/icon_57.png
app_icon_114x114 = /assets/app_icons/icon_114.png
app_icon_72x72 = /assets/app_icons/icon_72.png
app_icon_144x144 = /assets/app_icons/icon_144.png
app_icon_167x167 = /assets/app_icons/icon_167.png
launch_image_320x480 = /assets/launch_images/ios_launch_320x480.png
launch_image_640x960 = /assets/launch_images/ios_launch_640x960.png
launch_image_640x1136 = /assets/launch_images/ios_launch_640x1136.png
launch_image_750x1334 = /assets/launch_images/ios_launch_750x1334.png
launch_image_768x1024 = /assets/launch_images/ios_launch_768x1024.png
launch_image_1536x2048 = /assets/launch_images/ios_launch_1536x2048.png
launch_image_1024x768 = /assets/launch_images/ios_launch_1024x768.png
launch_image_1242x2208 = /assets/launch_images/ios_launch_1242x2208.png
launch_image_2208x1242 = /assets/launch_images/ios_launch_2208x1242.png
launch_image_2048x1536 = /assets/launch_images/ios_launch_2048x1536.png
launch_image_2048x2732 = /assets/launch_images/ios_launch_2048x2732.png
launch_image_2732x2048 = /assets/launch_images/ios_launch_2732x2048.png
launch_image_1334x750 = /assets/launch_images/ios_launch_1334x750.png
launch_image_1125x2436 = /assets/launch_images/ios_launch_1125x2436.png
launch_image_2436x1125 = /assets/launch_images/ios_launch_2436x1125.png
launch_image_1668x2224 = /assets/launch_images/ios_launch_1668x2224.png
launch_image_2224x1668 = /assets/launch_images/ios_launch_2224x1668.png
bundle_identifier = com.example.todo

[osx]
bundle_identifier = com.example.todo

[android]
app_icon_36x36 = /assets/app_icons/icon_36.png
app_icon_48x48 = /assets/app_icons/icon_48.png
app_icon_72x72 = /assets/app_icons/icon_72.png
app_icon_96x96 = /assets/app_icons/icon_96.png
app_icon_144x144 = /assets/app_icons/icon_144.png
app_icon_192x192 = /assets/app_icons/icon_192.png
input_method = HiddenInputField

[script]
shared_state = 1

[physics]
gravity_y = -1000.0
scale = 0.01

[html5]
htmlfile = /fbinstant/index.html
custom_heap_size = 600000000
set_custom_heap_size = 1

[fb_instant]
stretch_canvas = 1

How many atlases do you have and what are their sizes? Do you have all of them loaded at the same time?

i have used 3 atlases.i think all this load same time.Is there any way to load it dynamically. main atlases need to be load when init the screen and then rubber atlases and miss-rock-1 atlases need to load.

I’m more curious about the pixel size of each atlas:

1 Like

@britzl, Those are the pixel size of each atlas
misrock atlases - 4096 * 4096
main atlases = 8192 * 8192
rubber atlases = 4096*4096

please help me

These are huge and will eat up a really large amount of memory!

Uncompressed size:

misrock atlases - 4096 * 4096 = 67 108 864 bytes
main atlases = 8192 * 8192 = 268 435 456 bytes
rubber atlases = 4096*4096 = 67 108 864 bytes

Total size: ~400MB

It’s not even certain that all devices support 8k textures. Check these stats: https://webglstats.com/webgl/parameter/MAX_TEXTURE_SIZE

Are you really using all of the graphics at once? Is the graphics perhaps larger than it needs to be (ie are you scaling down the game objects to get the proper size on sprites etc)? Are you using texture compression (more details here)?

1 Like

I started creating a manual to cover various optimization tips:

I will add more content to it when I have time, but it’s a start at least!

3 Likes

I got

RuntimeError: memory access out of bounds,RuntimeError: memory access out of bounds

Too, I think it might be due to texture size but not sure at the moment. It would be useful to have warnings when building/ bundling for possible problems like this.

When did it happen? After adding new images? Did you try to increase the heap size?

It stops happening when I disable one of our splash screens which has a 4096x4096 atlas. But when it’s isolated in a blank project it doesn’t cause problems. I tried increasing the heap to 512 from 256 but it didn’t change the error. Really not sure of the specific issue, when we load we also load 30MB of FMOD banks into memory too since that’s the only way easily possible right now in HTML5 - this is for full version of FSH HTML5 release. For now we’ll disable the splash that is triggering it, I’ll send you the assets in case they are somehow related directly and it’s not just too much at once. Though we use Monarch too and other screens have just as big atlases so it’s puzzling.

Do you get a stacktrace as well as the error message? It’s an Emscripten error and by Googling for that error message it seems like you should get a stacktrace as well.

I’ll send you a copy of the produced project soon.