Godot: Buffer overflow when instancing 14563 PackedScene.

Created on 21 Apr 2017  ·  3Comments  ·  Source: godotengine/godot

Operating system or device - Godot version:
Linux - Ubuntu Mate 16.10 - Godot 2.1.2 stable

Issue description:
I was facing an over usage of RAM with my Godot 2D game prototype, and I decided to find the cause of it. I wanted to see how many PackedScene instance Godot could handle without blowing out my RAM.

I built a main scene with a simple architecture:

---> Node // Script attached  here
       +----> YSort

I built also a scene called "Hexa.tscn", with a simple architecture too:

---> Area2D
       +-----> Sprite

In a script attached to the root node of the main scene I try to add as much "Hexa" scene instance as possible in the YSort Node.

If I add 14562 Hexa scene instances, everything goes well (~3% usage of 1 CPU, ~115Mo RAM usage, that represents: 29655 Objects, 3 Resources, 29127 Nodes)

But if I add 14563 Hexa scene instances, I encounter a buffer overflow error, as follow:

In the Error tab of the debugger:

Type: Error
Description:
Time: 0:00:00:0458
C Error: Condition '(buffer_end+room_needed) >= buffer_size' is true. returned ERR_OUT_OF_MEMORY
C Source: core/message_queue.ccp:54
C function: push_call

In the Output tab of the debugger:

failed method: Sprite:_update_callback target ID: 29681
TOTAL BYTES: 1048560
NULL count: 0
CALL _sort_children: 14564
CALL_update_callback: 29126

Is this a bug ?

Steps to reproduce:
Run the attached Godot project in Godot editor to see the error in the debugger.

Link to minimal example project:
memtest.tar.gz

archived enhancement junior job core

Most helpful comment

Hi @Faless !

I am glad to know that this issue is apparently not a bug, but just a misconfiguration of a setting on my part.

Thanks for you for the enlightment :)

Could it be interresting to improve the error message, in order to inform the user about this message_queue_size_kb setting tuning ?

All 3 comments

You want to increase the maximum size of the message queue in:

project settings -> core -> message_queue_size_kb
to something higher.

I would in any case avoid creating so many nodes for performance reasons.

Hi @Faless !

I am glad to know that this issue is apparently not a bug, but just a misconfiguration of a setting on my part.

Thanks for you for the enlightment :)

Could it be interresting to improve the error message, in order to inform the user about this message_queue_size_kb setting tuning ?

I would like to inform you that in Godot 3.1 Alpha 2 the error message is even worst:

image

It took me quite some time to realize that I reached the limits of the message queue.

Was this page helpful?
0 / 5 - 0 ratings