• Welcome to World Machine Community. Please login or sign up.
 
October 13, 2019, 06:04:51 pm

News:

Read the Development Diary for an inside look at World Machine's progress!


Memory leak in tiled builds

Started by Amiag, August 20, 2009, 08:48:17 am

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Amiag

August 20, 2009, 08:48:17 am Last Edit: August 24, 2009, 01:32:01 am by Amiag
Hi, im experiencing some kind of memory leak that prevents me from completing tiled builds on my machine

(WM2.15 on vista 32b , 4GB ram)
The world extents is very small and the tiles are very small too (256*256).

The tiles are actually built, but in the blending phase, it inevitably runs into an out of memory error.

It looks like in the blending phase, world machine does not deallocate the memory its using, thus leading to an out of memory error for big tile sets (20*20 or more). Also after the out of memory error, WM continues to use all the memory and needs a restart to free the resources and work again.

I'm ONLY bulding tiles, they are not merged in a single image. The problem does not raise in the building phase, all tiles are built correctly. the problem occurs in the blending phase, which happens after the build and before the writing of outputs. The first 20 or so tiles are output correctly to disk as images before the out of memory error occurs.

I'm pretty sure this is a bug, WM does not free resources of the completed tiles in the blending phase, since I see a constant increase in memory usage during the blending phase. This makes no sense as the resources of each tile should be freed once the outputs are written to the disk and there are no other nearby tiles that requires blending.

I've attached a simple project that produces this error :
http://www.mediafire.com/?sharekey=ec2e1c476e094d34e7ba8e3c6e11ce20e04e75f6e8ebb871


Edit :
I've noticed (too late) theres another thread about this problem :
http://forum.world-machine.com/index.php?topic=1122.0

Any help will be greatly appreciated, as this problem is basically preventing me from completing any build.

nikita

Are you using memory conservation?

Also: With 32bit Vista you will not be able to use 4GB ram, only 2 or 3maybe. (but this shouldn't matter for your problem)
"Every time you read or write beyond the end of an array, somewhere a fairy dies."
Richard Buckland

Nav

August 21, 2009, 06:02:47 am #2 Last Edit: August 21, 2009, 06:28:21 am by Nav
actually it still might be a problem if the final image sise is too big for his memory..but it shouldnt with that device chain.   Most of the time i ran into this problem on my old machine was with very complex networks. You know that by using such small tiles your going to get alot of blending yuk.  Its a simple enough device so why dont you try using larger tiles and if you still cant merge them..do it post in photoshop...its going to take longer to render but its worth it.

as for the 3gb for an application in windows..its called a 3gb switch..not that hard todo either.

Amiag

August 23, 2009, 07:07:39 am #3 Last Edit: August 23, 2009, 07:10:17 am by Amiag
Yes I'm using memory conservation, but I tried both ways.

Also i'm ONLY bulding tiles, they are not merged in a single image. The problem does not raise in the building phase, all tiles are built correctly. the problem occurs in the blending phase, which happens after the build and before the writing of outputs. The first 20 or so tiles are output correctly to disk as images before the out of memory error occurs.

I'm pretty sure this is a bug, WM does not free resources of the completed tiles in the blending phase, since I see a constant increase in memory usage during the blending phase. This makes no sense as the resources of each tile should be freed once the outputs are written to the disk and there are no other nearby tiles that requires blending.

Please let me know if I can provide some further information for this problem.

aguru

You might be able to work around this issue by setting your pagefile to a *large* value like 16 gigs... Its not a nice solution and I too think this is a bug - but it works.

Amiag

August 24, 2009, 01:23:39 am #5 Last Edit: August 24, 2009, 01:29:54 am by Amiag
I tried this already, with a swap file of 32 Gbs, but it still runs in out of memory when it runs out of RAM, no matter how big the swap file is.Dont know if it is some limitation of vista, im gonna try on a XP machine as soon as I can.

Nav

OK well because you are not merging them anyway..you could simply limit the number of tiles its outputting..then do the rest next time around.  To me it makes sense that the memory increases during blending because as more tiles are processed for blending the more blending info it would need to hold for the other tiles next to them..I don't know how its written in code..I did try your example file on my 64bit machine here and the memory consumption goes up to about 3.4GB..so its just too much for your 32bit OS..which is why there is the 64bit exe with worldmachine. But anyway i would just limit the number of tiles being output..Ive also had to do this on my old machine at times

Amiag

August 24, 2009, 03:09:56 am #7 Last Edit: August 24, 2009, 03:13:48 am by Amiag
No it does not make sense to have memory consuption constantly increase during blending. It should only increase up to the maximum number of tiles used in a blending operation. If the memory consuption is normal, then it means that a blending operation involves up to 30 or 40 tiles and I doubt it.

If on your machine my test runs fine, try monitoring the ram usage and you will see that in the building phase it is constant around 500Mb (I dont remember the exact number) while in the blending phase it slowly rises up (to 3.4 Gb as you say).

Also i cannot reduce the tiles number, as it would reduce the terrain resolution. Since I cant reduce the world extent anymore, the only way to have such resolution is to increase tiles number.



Nav

what i mean by reduce the number of tiles is..to output lets say 18 at a time.  Normally there is a check box that says always build all tiles..but this can be switched off and you can select a range of tiles..This way you can output just a small number of the tiles or all the tiles when you do a build. 

Say for example you have a world with a world extent of 4 x 256 tiles, these tiles are represented by a tile number 0,0/0,1 ect.  If you select a range from 0,1 to 1,1 you will get the top 2 tiles.  This will work Ive also used it before when I ran out of memory.  Just a tip use the overview mode to show the tile numbers so you can easily see which ones you want...

Amiag


Amiag

I managed to run a full build by splitting up the tiles as suggested by Nav. My build consisted of 4096 256X256 tiles  that I splitted in groups of around 400 tiles each when building. However I had to restart WM after every build, cause I keep experiencing the memory leak problem , even with successfull builds. IE : If I run two builds of 400 tiles one after the other, the first is successfull the second one runs into out of memory error. If I restart WM inbetween, everything works.

Nav

Cool that it worked..and I guess you kinda prove the point that memory doesnt come back..since you have to restart wm..but I guess that no big deal seeing as when you do a tiled build it doesnt keep the data from the network anyway.  My only fear for your worls is that with so much blending across the tiles you will notice it..i know it takes longer to render bigger tiles but if you find the result isnt seemless enough try some bigger tiles..

Quick Reply

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

Note: this post will not display until it's been approved by a moderator.

Name:
Email:
Verification:
Please leave this box empty:
Type the letters shown in the picture
Listen to the letters / Request another image

Type the letters shown in the picture:

Shortcuts: ALT+S save/post or ALT+P preview