Realistic Terrain Generation

Realistic Terrain Generation

3M Downloads

0.5.0-snapshot 4 leaks memory during world gen

Haggle1996 opened this issue · 20 comments

commented

A lot of my alpha Revolution|2 players (including myself) are reporting a slow leak of memory with 0.5.0 snapshot 4 during world gen. When selecting BoP world types with the same mod set, either the memory leak is gone, or is so small we don't notice the impact.

On a related note, the memory requirements using RTG 0.5.0-4 are significantly higher than BoP worlds. Players of my pack can get by with 3-3.5GB of RAM for a BoP world, but I've had to recommend 6GB for those using RTG, as they go out of memory otherwise after generating around 1000-2000 chunks via exploration. Note that these memory issues do not occur when no world generation is occurring. Memory utilization was also much better under 0.4.

Another oddity (not a bug report, just observation): if I pregen with AdminCommandsToolbox, I have the memory issues very quickly. If I pregenerate the world using ForgeEssentials, only the land forms generate. Ore doesn't appear until a player actually comes in range of the chunks (we use COG for ore generation, so this isn't an RTG issue). In the FE scenario, we don't run into the memory issues, even with extensive amount of post-generation exploration.

I know debugging memory issues is a major pain -- even more so when you've got a bajillion other mods in the mix; I'll do my best to narrow down what's actually driving those numbers up. I just wanted you to be aware of the big jump in memory since the last update.

Pack can be found here: https://www.atlauncher.com/pack/Revolution2

commented

How much of a memory leak, and is it RTG or CC? CC has a biome cache for chunk wall prevention, which can be shut off in the configs. It should only use a few dozen K, though.

commented

Let me fire it up with Visual VM and see if I can identify where the leak is.

commented

Could you run a gen once with RTG off (in a default world) and see if the same thing happens?

commented

You can deactivate that CC caching with

I:biomeRingsNotSaved
I:climateRingsNotSaved
I:subBiomeRingsNotSaved

all set to -1. They are critical only for the chunk wall prevention, which isn't a problem if you're not changing biomes or incidences. They probably provide a performance boost during generation.

commented

Some visual VM images. http://imgur.com/a/41AHC

All the bloat is in the server thread, for the world gen stuff. I can send snapshot files over, if you like. FYI, this is on a i7-4790k, 16GB RAM, SSD.

EDIT: This is after about 30 seconds of flying over ocean, generating new chunks. It seems to go out of memory faster while travelling over the water than land.

commented

These options don't seem to have a significant impact on memory. It's still very high in snapshot 5

commented

Does it happen in a default world with CC? Or in a Realistic world without CC?

commented

I only tested the CC with vanilla world type today, and the problem persisted. Will try RTG without CC next.

commented

OK, then it's a "leak" in CC. Actually it's probably not a "leak" per se but one of my caching systems getting large. You can try turning off the biome caching as I mentioned above. I'll look at not keeping all the info in memory although I dread managing a file system.

commented

@Haggle1996 - did you try turning off the biome caching? Has it made any difference?

commented

Testing this now; hampered by the fact that since RC2, vast oceans seem to generate even more often, even with tripling the seed incidences. Though I admit that's subjective. I have noticed the memory requirements of RC2 are a good 10-15% lower.

commented

After pregenerating 8 test worlds with biome caching off, I've noted the following:

  • Initial memory (when the player first loads into the world) is about .5GB lower than previously.
  • Terrain generation is noticeably faster.
  • Minecraft exhausts it's RAM faster, at around 900-1100 chunks generated, versus around 1600-1700 with snapshot 5 and no biome caching; I have 6GB allocated for these test runs.
  • Wrong biomes (reported in #439) were only observed on islands; continents seem correct. Setting med/large island incidences to 0 and only generating continents did not generate any bad biomes in my last test world. This may have been completely luck of the RNG.
  • Incidences of starting in the deep ocean feel much more frequent (see #396). Of the 8 randomly generated worlds, I only started on land in two of them, even after tripling and quadrupling the incidences.

Final incidence config:

"ocean control parameters" {
    # frequency of large continent seeds, about 8000x16000
    I:"Large Continent Frequency"=80

    # frequency of large island seeds, about 500x1000
    I:"Large Island Frequency"=40

    # frequency of medium continent seeds, about 4000x8000
    I:"Medium Continent Frequency"=240

    # frequency of medium island seeds, about 250x500
    I:"Medium Island Frequency"=0

    # True reduces the chance of landmasses merging
    B:SeparateLandmasses=true

    # frequency of small continent seeds, about 2000x4000
    I:"Small Continent Frequency"=80
}

Sample Seeds:

  • 2206248600806339435
  • 8646154959864039465
  • -573952144002966935
commented

Something seems to be not working with the configs, so changing the land incidences may not be working. However, "separate landmasses" effectively puts a land cap of 40-45% - this is essentially mathematical, as you can't have more densely packed random blobs and still keep them separate.

commented

As you said, something is not working in the configs. :D I turned off SeparateLandmasses and generated another 6 test worlds. All of them ended up with spawn in the middle of the ocean.

commented

@Haggle1996 Are you still experiencing memory issues with RTG 0.5.0 and CC Beta39?

commented

I will be testing this more tonight and tomorrow morning. I will let you
know.

On Fri, Jan 29, 2016 at 1:38 PM, WhichOnesPink [email protected]
wrote:

@Haggle1996 https://github.com/Haggle1996 Are you still experiencing
memory issues with RTG 0.5.0 and CC Beta39?


Reply to this email directly or view it on GitHub
#404 (comment)
.

commented

Memory is cleaning up much faster now, thank you. I still see a small leak in my pack, but I believe that's due to Custom Ore Gen.

commented

Out of question, should I retain the tweaked settings we toyed with during deubbing, such as the RingsNotSave = -1, PercentRiverReduction=100, and NoBoPSubBimes=false? Or is it safe to use defaults now?

commented

Glad things have improved on the memory side of things :)

As for the settings...

If you expect your world to be larger than 10k x 10K, you should probably leave the 'xxxRingsNotSaved' = -1

PercentRiverReduction is hardcoded to 100 for Realistic worlds regardless, so you don't need to worry about that one.

And NoBoPSubBiomes=false ... If you want BOP's sub-biomes to generate in your world, you should leave it false.

commented

Just to illustrate the difference with 0.5.0 release, I'm pregenerating around 4800 chunks before going out of memory, versus the 1600ish at best with snapshot 5. I used to get around 3000 with RTG 0.4.0. It's not a scientific benchmark, but seems significantly better.