Max number of resources

Hi there,

I don’t understand these lines from the Project setting manual:

“Max Resources. The max number of resources that can be loaded at the same time, 1024 by default.”

How is the “number of resources” defined?

Also. My project runs fine on my mac but on my Android device it crashes with the following error:

ERROR:RESOURCE: The max number of resources (1024) has been passed, tweak “resource.max_resources” in the config file.

At the beginning of the log I see also:
WARNING:CRASH: Number of modules exceeds capacity

Could anyone help me understand what is going on?

Thanks very much in advance!

Ciao, Rocco.

1 Like

In the engine, there is a “resource system” that holds resources in memory while they’re needed. These are files loaded from the game archive (.arcd). E.g. textures, sounds, collections etc.
1024 resources loaded is quite a lot, but you may up that value in your game.project to make it work anyways.

I’m not sure why it works on your mac though, it should have the same constriants iirc (@sven @jhonny?)

WARNING:CRASH: Number of modules exceeds capacity

This is a warning from our internal crash module that it cannot store all the info about all the modules loaded. You can safely ignore this and we should probably remove it altogether.

2 Likes

Thank you for your reply!

Is there a way to ask the engine how many resources it is using?

(As usual, thanks for your great work with Defold!)

There’s no good way to know how many resources you would need.
Try upping the value 128 at a time.

But also, when actually running, profile the game to see what resources are actually loaded (1024 is already quite a lot)

2 Likes

I have launched the web profiler and added up all the RefCounts for the resource panel. The total count is about 100.

Is this the right way to count the resource number? If it so, then something else is going wrong on the Android device resulting in that error…

Thank again for your help!

The number of resources is the length of the list of loaded resources (to the right):

The refcountis how many other resources that are referring to that resources (when it reaches 0, the resource is unloaded)

2 Likes

So in my case the number of resources is about 70… very far from the limit of 1024.

On Android. While the engine is claming that

ERROR:RESOURCE: The max number of resources (1024) has been passed

I guess something else is going wrong. How could I find more information about this problem?

Thanks for your help!

Yeah, 70 seems much more reasonable.
Does it happen right away? After loading a certain collection? Or after a while?
E.g. are you spawning new objects (not sure if we create new resources then)

If it doesn’t fail right away, you can try using the webprofiler by connecting to the device. Use it’s ip, and port 8002.

1 Like

It happens when the main collection of the game is loaded via a collectionproxy. The game runs fine in the title section and in the level selection section (both are loaded and unloaded via collectionproxy’s). So it seems hard to get a sample via webprofiler exactly when the play collection is loaded.

Here is a more complete log of the issue:

07-20 16:09:33.393 15425 15448 E defold : ERROR:RESOURCE: The max number of resources (1024) has been passed, tweak “resource.max_resources” in the config file.
07-20 16:09:33.493 15425 15448 E defold : ERROR:RESOURCE: The max number of resources (1024) has been passed, tweak “resource.max_resources” in the config file.
07-20 16:09:33.493 15425 15448 W defold : WARNING:RESOURCE: Unable to create resource: /game/main/collections/world_name_it_generated_0.goc
07-20 16:09:33.510 15425 15448 E defold : ERROR:RESOURCE: The max number of resources (1024) has been passed, tweak “resource.max_resources” in the config file.
07-20 16:09:33.510 15425 15448 W defold : WARNING:RESOURCE: Unable to create resource: /game/main/collections/world_name_it_generated_2_generated_0.spritec
07-20 16:09:33.510 15425 15448 W defold : WARNING:RESOURCE: Unable to create resource: /game/main/collections/world_name_it_generated_2.goc
07-20 16:09:33.527 15425 15448 E defold : ERROR:RESOURCE: The max number of resources (1024) has been passed, tweak “resource.max_resources” in the config file.
07-20 16:09:33.527 15425 15448 W defold : WARNING:RESOURCE: Unable to create resource: /game/main/collections/world_name_it_generated_3_generated_0.spritec
07-20 16:09:33.527 15425 15448 W defold : WARNING:RESOURCE: Unable to create resource: /game/main/collections/world_name_it_generated_3.goc
07-20 16:09:33.544 15425 15448 E defold : ERROR:RESOURCE: The max number of resources (1024) has been passed, tweak “resource.max_resources” in the config file.
07-20 16:09:33.544 15425 15448 W defold : WARNING:RESOURCE: Unable to create resource: /game/main/collections/world_name_it_generated_4_generated_0.spritec
07-20 16:09:33.544 15425 15448 W defold : WARNING:RESOURCE: Unable to create resource: /game/main/collections/world_name_it_generated_4.goc
07-20 16:09:33.564 15425 15448 I defold : INFO:CRASH: Successfully wrote Crashdump to file: /data/user/0/com.example.todo/files/_crash

My guess is that the engine is loading something in a wrong way, for example looping the load of some resource.

Also, how can I retrive the crashdump from the device?

Thanks!

If you can perhaps share a small minimal example (or the project if that’s ok) with us, by zipping it and posting or sending a DM to @sven, @jhonny.goransson or @AGulev (I’m still on vacation) perhaps we can figure it out.

Also, to get a crash log from Android, you can follow this manual

1 Like

Thank you! I succeeded in getting the crash log; how may I attach it here? The uploader is complaining about the allowed file types. Is it fine to add the extension “.txt”?

sure, name it _crash.txt

1 Like

Thanks for the suggestion.

_crash.txt (49.2 KB)

The crash log is attached. I hope you could give me some help; otherwise I will share the whole project (at this point of the development of the game, it is highly difficult to prepare a minimal example).

Thanks!

Could you post your game.project file? You can also upload zip files.

1 Like

Here it is, thanks!

game_project.zip (1.2 KB)

Hi!

Any help using the crash log and the game project? I am really stuck on this for days…

Would it be possible for you to send me the project at sven.andersson@king.com and I can take a quick look at it?

The crash-file sadly didn’t give me enough information. However, it looks like you don’t have any extensions or app-manifests so it’s a “vanilla” engine binary, which would indicate some bug/issue on our side.

2 Likes

Sure, thanks!

I am going to add you to the project on bitbucket.

@sven I added you to the project and sent you a (very) short email of explanation.

Many many thanks!

1 Like

Perhaps you are loading too many proxies at a time. Put print statements before you load anything and see how many times that’s called.