PDA

View Full Version : Infinite repaint() loop


fljmayer
03-03-2008, 11:08 PM
I have put WWJ 0.4.1 into an Eclipse view; this may be the source of my problem, but it doesn't look like that to me. So here is the problem:

I only add WMS layers to the canvas as BasicTiledImageLayers. This works just fine for only a few layers, but when I add some more (still less than 10) or maybe disable and then enable a bunch, the view seems go into an infinite repaint() loop. As far as I can tell, BasicTiledImageLayer.RequestTask.run() through a event eventually triggers a repaint of WorldWindowGLCanvas, which in turn triggers the running of more RequestTasks. The visual result is that the individual layers constantly pop in and of existence, usually one after the other; when a layer comes back it goes through all the pyramid layers. Sometimes it stops after a while, but at other times it goes on forever. Sometimes it is only a single layer that comes and goes, but mostly all of them.

I also noticed that my "Texture" and "Texture Tile" cache are getting full, even though I set them to 200,000,000 and 100,000,000 respectively. My impression was that my problems coincided with a full cache. Anyway, I thought it was odd that the actual heap usage was maybe 100MB when both caches where throwing out entries because they were full.

Am I doing something wrong? Can I fix this somehow?

remleduff
03-03-2008, 11:28 PM
I've seen the same thing when I couldn't keep all the visible tiles in memory. They just continually redraw. I think the correct answer is "don't do that." ;)

You can edit config/worldwind.properties and make your memory cache bigger (it's the TextureTileCache property) and see if that helps, you might also need to adjust the -Xmx of the script that starts your worldwind to allow it a larger heap size.

fljmayer
03-04-2008, 03:06 AM
Thanks for confirming this behavior. I already increased the relevant caches to the sizes mentioned in the original post, and I still have that problem. I would think that 200MB/100MB should be enough to display just a handful tiles. Which makes me think that maybe the correct answer is "this is a bug" ;)

remleduff
03-04-2008, 04:06 PM
Are you sure?

Each dds tile is 350kB for me, times 10 is 3.5 MB, times 100 tiles for each say is going to be more than 300 MB (excuse the back of the envelope calculations).

100 tiles for each layer is a pretty bad assumption though, I admit, unless maybe you have your layers configured so they display with too high a resolution too early.

If you enable logging do you get messages about the cache? They were logged frequently when I saw the same thing.

fljmayer
03-04-2008, 09:07 PM
Okay, I may be filling up the cache still. But why should that cause constant repaints? I can understand that the loading of the uncached data makes things slower, but is it necessary to repaint everything when another tile has been loaded? It looks like this new tile is added to the full cache, which means something else fell out, and the redraw then causes the tile that just fell out to be loaded again. This means that system goes into an infinite loop when the cache is full, which makes it quite uncontrollable.

remleduff
03-04-2008, 11:01 PM
In fact I'm pretty sure that's what happens. :)

The new tile enters the memory cache which increases the memory pressure and causes another tile that needs to be displayed to be evicted, ad infinitum.

Maybe worth filing a bug about? I'm not sure what should happen when the caches fill up though, honestly.

nlneilson
03-04-2008, 11:09 PM
One reason the memory can load up is ALL the lower res tiles for an area may be pulled in even if you are zoomed in to view a hi res tile.
Issue WWJ-119
http://issues.worldwind.arc.nasa.gov/secure/IssueNavigator.jspa?reset=true&mode=hide&pid=10021

patmurris
03-05-2008, 03:41 AM
Try running the example.RuntimeStatistics to see how many tiles are in memory. How many layers are you displaying?