Max number of resources

#1

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

#2

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

#3

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!)

0 Likes

#4

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

#5

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!

0 Likes

#6

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

#7

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!

0 Likes

#8

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

#9

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!

0 Likes

#10

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

#11

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”?

0 Likes

#12

sure, name it _crash.txt

1 Like

#13

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!

0 Likes

#14

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

1 Like

#15

Here it is, thanks!

game_project.zip (1.2 KB)

0 Likes

#16

Hi!

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

0 Likes

#17

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

#18

Sure, thanks!

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

0 Likes

#19

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

Many many thanks!

1 Like

#20

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.

0 Likes