"Bad Allocation"

This is an error that occurred when I used smooth terrain, but it could happen any time anyone has to do with large amounts of memory (I believe this might be video memory as this only happens when the terrain is being rendered).

I was attempting to import an island from a heightmap. I’d like the map to be about 30k x 30k studs in size. The script I used to do that ran just fine. The problem occurred when I then moved my studio camera around to look at the terrain - the output got spammed with ‘bad allocation’ errors and Studio froze. I then had to force quit and restart Studio.

I’m starting to get issues at only 6000x7000 studs, when less than half the map is being rendered. RAM usage was at 2700 MB when this happened.
I have 32 Gigabytes of RAM (24 of which were free when the error occurred). My graphics card is a nVidia GeForce 760M. Not sure how much memory that has.

A possible fix would be to force far-away parts of the terrain to unload to make space for ones that are closer?

Repro: The attached out.txt file is the script I used to generate the island. Simply run it in Studio, then move the camera around and let the terrain render once it prints out ‘Done!’.

If you’re lucky and can load the map fine, try increasing the ‘sh’ variable at the bottom of the script I attached.

3 Likes