Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Buffer overflow when instancing 14563 PackedScene. #8483

Closed
ducdetronquito opened this issue Apr 21, 2017 · 3 comments
Closed

Buffer overflow when instancing 14563 PackedScene. #8483

ducdetronquito opened this issue Apr 21, 2017 · 3 comments

Comments

@ducdetronquito
Copy link
Contributor

ducdetronquito commented Apr 21, 2017

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

@Faless
Copy link
Collaborator

Faless commented Apr 23, 2017

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.

@ducdetronquito
Copy link
Contributor Author

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 ?

@akien-mga akien-mga changed the title [Bug] Buffer overflow when instancing 14563 PackedScene. Buffer overflow when instancing 14563 PackedScene. Apr 28, 2017
@akien-mga akien-mga added this to the 3.0 milestone May 5, 2017
@Ploppy3
Copy link

Ploppy3 commented Nov 21, 2018

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants