ID:2183820
 
Quick question. I have someone trying to use this:

turfs = new/list(maxx*maxy*maxz)
world.log << "DEBUG: TURFS LIST LENGTH [turfs.len]"


This is causing some issues sort of out of nowhere, causing runtimes and breaking world initialization.

I thought this might be related to blowing past the list length limit. I know that it _used_ to be 65,535, but all references to that limit are from like ten years ago.

What is the current list length limit and does anyone have any idea what might be happening here?

- J
What are the runtimes you are experiencing?

What are the dimensions of maxx, maxy, and maxz?
It gave a null pointer exception on the second line (the log write) and apparently also screwed up other lists in memory.

I'm guessing by your question you do not suspect it to be caused by the limit on the length of lists?
I don't think the list is actually being initialized with a length of anything more than one in the first place. The list initializer doesn't take a length argumemt if i recall correctly.

Okay, yeah, definitely need to know the value of maxx, maxy, and maxz. My guess is that your world is entirely too big, as lists should be able to handle as many as about 16 million indices.

Thing is, what you are probably running into isn't a problem with the list being too large, but rather a problem with BYOND already overflowing the turf limit.

I've found that BYOND games don't tend to handle worlds larger than 1000x1000x200 before running into massive memory issues, and they should probably crash long before that, around 1000x1000x17.

Ideally, you want to keep your turf count lower than 4 million.

My guess is what's happening is that BYOND's simply running out of space for one thing or another and multiple lists are overflowing because of too many turfs in the first place.

But yes, it does sound like an overflow of some sort, so your guess is a good one.
Internally, lists should technically allow for around 4 billion items--although accessing them by index after about 16 million won't really work, since BYOND uses single-precision floating point numbers. To be more specific, the list length is a 4-byte integer. However, BYOND would run out of memory long before you hit that point.

If you have right around 16.8 million turfs--3 bytes' worth--then a list of that length would have a memory footprint of 64MB for just its array (and a trivial amount, by comparison, for the list structure). That's really not nice to do to the server, but a list that size should be feasible for BYOND to handle without incident unless memory usage is already stressed.

Also this is worth pointing out: There's already going to be an internal array of exactly that size, to say nothing of the structures holding turf data, vars, etc. for turfs that have any information defined.