* Cleaned up some loose ends with free tiles that are paged out of the cache.
* Finally I think I have the partial ssg tree deletion routine working correctly after I managed to break it (and other confusion in the code cause it to never be called so I didn't notice the problem.) * Converted several SG_INFO statements to SG_DEBUG to clean up some extraneous console output. * This *should* conclude my investigation into a massive memory leak. :-)
This commit is contained in:
parent
0ebe8ec8f0
commit
4dac47f558
2 changed files with 17 additions and 17 deletions
|
@ -144,7 +144,7 @@ bool FGNewCache::make_space() {
|
|||
}
|
||||
|
||||
} else {
|
||||
SG_LOG( SG_TERRAIN, SG_INFO, "loaded = " << e->is_loaded()
|
||||
SG_LOG( SG_TERRAIN, SG_DEBUG, "loaded = " << e->is_loaded()
|
||||
<< " pending models = " << e->get_pending_models()
|
||||
<< " time stamp = " << e->get_timestamp() );
|
||||
}
|
||||
|
@ -153,9 +153,9 @@ bool FGNewCache::make_space() {
|
|||
// If we made it this far, then there were no open cache entries.
|
||||
// We will instead free the oldest cache entry and return true
|
||||
|
||||
SG_LOG( SG_TERRAIN, SG_INFO, " min_time = " << min_time );
|
||||
SG_LOG( SG_TERRAIN, SG_INFO, " index = " << max_index );
|
||||
SG_LOG( SG_TERRAIN, SG_INFO, " max_time = " << max_time );
|
||||
SG_LOG( SG_TERRAIN, SG_DEBUG, " min_time = " << min_time );
|
||||
SG_LOG( SG_TERRAIN, SG_DEBUG, " index = " << max_index );
|
||||
SG_LOG( SG_TERRAIN, SG_DEBUG, " max_time = " << max_time );
|
||||
if ( max_index >= 0 ) {
|
||||
entry_free( max_index );
|
||||
return true;
|
||||
|
|
|
@ -688,8 +688,8 @@ ssgBranch* FGTileEntry::gen_runway_lights( ssgVertexArray *points,ssgVertexArray
|
|||
// is intended to spread the load of freeing a complex tile out over
|
||||
// several frames.
|
||||
static int fgPartialFreeSSGtree( ssgBranch *b, int n ) {
|
||||
ssgDeRefDelete( b );
|
||||
return 0;
|
||||
// ssgDeRefDelete( b );
|
||||
// return 0;
|
||||
|
||||
int num_deletes = 0;
|
||||
|
||||
|
@ -704,18 +704,14 @@ static int fgPartialFreeSSGtree( ssgBranch *b, int n ) {
|
|||
if ( n < 0 ) {
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
b->removeKid(i);
|
||||
}
|
||||
// remove the kid if it is now empty
|
||||
if ( kid->getNumKids() == 0 ) {
|
||||
b->removeKid( kid );
|
||||
num_deletes++;
|
||||
n--;
|
||||
}
|
||||
}
|
||||
// remove the parent if it is empty
|
||||
if ( b->getNumKids() == 0 ) {
|
||||
ssgDeRefDelete( b );
|
||||
num_deletes++;
|
||||
n--;
|
||||
}
|
||||
}
|
||||
|
||||
return num_deletes;
|
||||
|
@ -765,6 +761,7 @@ bool FGTileEntry::free_tile() {
|
|||
// disconnected from the scene graph)
|
||||
SG_LOG( SG_TERRAIN, SG_DEBUG, "FREEING terra_transform" );
|
||||
if ( fgPartialFreeSSGtree( terra_transform, delete_size ) == 0 ) {
|
||||
ssgDeRefDelete( terra_transform );
|
||||
free_tracker |= TERRA_NODE;
|
||||
}
|
||||
} else if ( !(free_tracker & GROUND_LIGHTS) && gnd_lights_transform ) {
|
||||
|
@ -772,6 +769,7 @@ bool FGTileEntry::free_tile() {
|
|||
// disconnected from the scene graph)
|
||||
SG_LOG( SG_TERRAIN, SG_DEBUG, "FREEING gnd_lights_transform" );
|
||||
if ( fgPartialFreeSSGtree( gnd_lights_transform, delete_size ) == 0 ) {
|
||||
ssgDeRefDelete( gnd_lights_transform );
|
||||
free_tracker |= GROUND_LIGHTS;
|
||||
}
|
||||
} else if ( !(free_tracker & RWY_LIGHTS) && rwy_lights_transform ) {
|
||||
|
@ -779,6 +777,7 @@ bool FGTileEntry::free_tile() {
|
|||
// disconnected from the scene graph)
|
||||
SG_LOG( SG_TERRAIN, SG_DEBUG, "FREEING rwy_lights_transform" );
|
||||
if ( fgPartialFreeSSGtree( rwy_lights_transform, delete_size ) == 0 ) {
|
||||
ssgDeRefDelete( rwy_lights_transform );
|
||||
free_tracker |= RWY_LIGHTS;
|
||||
}
|
||||
} else if ( !(free_tracker & LIGHTMAPS) && lightmaps_transform ) {
|
||||
|
@ -787,6 +786,7 @@ bool FGTileEntry::free_tile() {
|
|||
// disconnected from the scene graph)
|
||||
SG_LOG( SG_TERRAIN, SG_DEBUG, "FREEING lightmaps_transform" );
|
||||
if ( fgPartialFreeSSGtree( lightmaps_transform, delete_size ) == 0 ) {
|
||||
ssgDeRefDelete( lightmaps_transform );
|
||||
free_tracker |= LIGHTMAPS;
|
||||
}
|
||||
} else {
|
||||
|
@ -1444,12 +1444,12 @@ FGTileEntry::add_ssg_nodes( ssgBranch* terrain_branch,
|
|||
void
|
||||
FGTileEntry::disconnect_ssg_nodes()
|
||||
{
|
||||
SG_LOG( SG_TERRAIN, SG_INFO, "disconnecting ssg nodes" );
|
||||
SG_LOG( SG_TERRAIN, SG_DEBUG, "disconnecting ssg nodes" );
|
||||
|
||||
if ( ! loaded ) {
|
||||
SG_LOG( SG_TERRAIN, SG_INFO, "removing a not-fully loaded tile!" );
|
||||
SG_LOG( SG_TERRAIN, SG_DEBUG, "removing a not-fully loaded tile!" );
|
||||
} else {
|
||||
SG_LOG( SG_TERRAIN, SG_INFO, "removing a fully loaded tile! terra_transform = " << terra_transform );
|
||||
SG_LOG( SG_TERRAIN, SG_DEBUG, "removing a fully loaded tile! terra_transform = " << terra_transform );
|
||||
}
|
||||
|
||||
// find the terrain branch parent
|
||||
|
|
Loading…
Add table
Reference in a new issue