Multi dimensional array size
#1

I have a house system with a furniture system as well but my questions is.. would 120,000,000 bytes affect the server wrongly? Because I have a maximum of 1000 houses and a maximum of 500 furnitures for each house. That makes the array really big.
Furniture[MAX_HOUSES][MAX_FURNITURE][HOUSE_FUR]

Without this the script is normally at 3,000,000 bytes
Reply
#2

Depends on how much memory your server has.

You can calculate how many cells you have, just by multiplying the indexes.

Supposing that MAX_HOUSES is 1000, MAX_FURNITURE is 500, and HOUSE_FUR is 100:

1000x500x100x4 = 200000000.

Sou you have 200 million bytes of memory alocation.

You can convert it into megabytes to a better understanding.

200000000 divided by 1024 = 192315,5 kbytes.
192315,5 divided by 1024 = 190,73 mbytes.

I'm sure your server can handle 190,73 MB. But the question is, you really need that much memory?

Don't forget you'll have to run another arrays and another programs.

Adjust your array to occupy less memory if you want to.
Reply
#3

Yeah i've reduced my max_houses define to 400 because the server isn't that big, so now it's using less memory. But yeah 190 MB is nothing as i've got 16 GB of memory and a pretty fast computer.
Reply
#4

Seems like way too many furniture slots how much does a house really need maybe 50.
Reply
#5

I have a custom interior for each house, players can choose either to have the default or an empty one so they can customize it with walls and textures. But 350 sounds reasonable.
Reply
#6

I just remembered about packed strings, it reduced the size by 50 million bytes

sorry for double
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)