Windows Crash when Creating Large Terrain

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
Dark Dragon DX
Posts: 24
Joined: Fri Nov 05, 2010 11:46 pm

Windows Crash when Creating Large Terrain

Post by Dark Dragon DX »

Hello. I haven't posted in a long time but I have come across a strange issue in Irrlicht 1.8.

On my Windows 7 Professional x64 system, attempting to have Irrlicht create a heightmap from an image of dimensions 4096x4096 causes a crash with the following console output:

Code: Select all

 
terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc
 
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
[Inferior 1 (process 2940) exited with code 03]
 
Using GDB I was able to determine that this is indeed the last call made before the crash:

Code: Select all

 
irr::scene::ITerrainSceneNode *terrain = smgr->addTerrainSceneNode(source); // Source is a file path to the wanted image
 
The program hangs up for a good 5-10 seconds before emitting the error above in console. The issue does not exist on the Linux machines I tested the code on.

Full Console output:

Code: Select all

 
C:\Users\Robert MacGregor\Desktop\KGE\bin>rendering_test_d
Kiaro Rendering Test Suite Started ------------------
Irrlicht Engine version 1.8.0
Microsoft Windows 7 Ultimate Edition Service Pack 1 (Build 7601)
Using renderer: OpenGL 2.1
Gallium 0.4 on SVGA3D; build: RELEASE;  : VMware, Inc.
OpenGL driver version is 1.2 or better.
GLSL version: 1.2
Resizing window (640 480)
Could not open file of texture: nskinbl.jpg
Could not open file of texture: nskinbl.jpg
Loaded mesh: base/models/ninja.b3d
Loaded texture: C:/Users/Robert MacGregor/Desktop/KGE/bin/base/textures/skin/nsk
inrd.jpg
terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc
 
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
The terrain is created right after the file nskinrd.jpg is loaded.

System: LUbuntu AMD64
GCC/G++ version: 4.7.3
Linux version: 3.8.0
64bit Build

System: Crunchbang Linux x86
GCC/G++ version: 4.7.2
Linux version: 3.10.4
32bit Build

System: Windows 7 Professional x64
GCC/G++ version: 4.7.1
32bit Build

I tested using two different files, one being 4096x4096 and the other 513x513 which loads properly.
The Broken File: http://dx.no-ip.org/height_broken.jpg
Any other file works okay: http://dx.no-ip.org/height_working.jpg
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

Re: Windows Crash when Creating Large Terrain

Post by hendu »

The error is clear, you ran out of memory.

16 million verts plus rounding plus overhead. You won't be fitting that to any VRAM less than 2GB (possibly not even there) -> bad performance.

You need some alternative way to visualize such large terrains, as you ran out of even regular RAM with this one. Check my geoplane for one.
Granyte
Posts: 849
Joined: Tue Jan 25, 2011 11:07 pm
Contact:

Re: Windows Crash when Creating Large Terrain

Post by Granyte »

if your program use less then 4gb in total and the performance of this is sufficient in total you could try enabling large address awareness on the x86 build
if your program use more then 4gb try an x64 build but that will limit the resulting program to be ran on x64 os

if you need more performance then what these solution can provide you with try the geoplane or a tilled terrain lod
Post Reply