josauder / procedural_city_generation

Procedural City Generation program implemented in Python and Visualized with Blender.
Mozilla Public License 2.0
561 stars 86 forks source link

Blender crashes after running out of memory #11

Open Mathboy19 opened 9 years ago

Mathboy19 commented 9 years ago

When trying to "Visualize in Blender", blender eats up of all my ram and swap, and then when both are at 100%, blender crashes and returns me to the main GUI. (I have 4 GB of ram, and 4 GB of swap.)

Console output:

Color management: using fallback mode for management
connect failed: No such file or directory
Malloc returns null: len=420642816 in dm_dupLoopArray tmp, total 844526948
Malloc returns null: len=157741056 in dm_dupPolyArray tmp, total 844526948
Writing: /tmp/blender.crash.txt
Segmentation fault (core dumped)
Color management: using fallback mode for management
connect failed: No such file or directory
Malloc returns null: len=420642816 in dm_dupLoopArray tmp, total 845117648
Killed
Color management: using fallback mode for management
connect failed: No such file or directory
Killed

As you can see, I tried running "Visualize" three times, with all three times failing. Note that:

Color management: using fallback mode for management
connect failed: No such file or directory

seems to be a Blender thing as it also happens when I run it outside of GUI.py

Oh, and the in-gui console returns the normal "Done, waiting for command" after blender crashes.

I would think that it should be possible to limit the amount of memory that Blender uses, although I'm no expert. Or maybe is there a way to reduce the size of the map, therefore reducing memory usage?

Thanks in advance.

P.S: The first time I set GUI.py up I had to change the variable path in jsontools.py from path="/home/jonathan/procedural_city_generation/procedural_city_generation" to path="/home/mathboy19/procedural_city_generation/procedural_city_generation" and it would be nice to have that automated in some way.

josauder commented 9 years ago

Thanks a ton for writing this up!

I fixed the path problem in jsontools and was able to reproduce the blender segfault when running it with a very large map.

You can change the map size with the attribute border when clicking on "options" next to roadmap. If this button does not exist (problem I found when testing it on windows yesterday), you can run

python UI.py roadmap --configure border [15,15]

This should halve the size (and therefore at least quarter the amount of memory used)

For a list of Parameters (and a short description) you can see "_params.py" in every submodule. Each of those parameters should be configurable with the command above in the form:

python UI.py <modulename> --configure <parameter name> <value>

I'm working on a way to make this more intuitive or at least document it properly somewhere.

If you run into more issues please keep posting them here, thanks again ! :)

Mathboy19 commented 9 years ago

Awesome, got it working for now, thanks!

I wounder if there would be any way to limit Blenders memory usage? It may not be possible, but it would be very helpful.