From 82b16301ec89989ef436f317f2f23f57ed2e2660 Mon Sep 17 00:00:00 2001 From: Nicolas Roard Date: Thu, 4 Aug 2011 10:11:47 -0700 Subject: Fix memory increase bug:5118763 Change-Id: Ice0f3792cd9e288459713411d755f1717896087e --- Source/WebCore/platform/graphics/android/TilesManager.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'Source') diff --git a/Source/WebCore/platform/graphics/android/TilesManager.cpp b/Source/WebCore/platform/graphics/android/TilesManager.cpp index 9a18758..b99cbfc 100644 --- a/Source/WebCore/platform/graphics/android/TilesManager.cpp +++ b/Source/WebCore/platform/graphics/android/TilesManager.cpp @@ -130,7 +130,10 @@ void TilesManager::allocateTiles() nbTexturesAllocated++; } - for (int i = 0; i < LAYER_TILES; i++) { + int nbLayersTexturesToAllocate = LAYER_TILES - m_tilesTextures.size(); + XLOG("%d layers tiles to allocate (%d textures planned)", nbLayersTexturesToAllocate, LAYER_TILES); + int nbLayersTexturesAllocated = 0; + for (int i = 0; i < nbLayersTexturesToAllocate; i++) { BaseTileTexture* texture = new BaseTileTexture( layerTileWidth(), layerTileHeight()); // the atomic load ensures that the texture has been fully initialized @@ -139,8 +142,13 @@ void TilesManager::allocateTiles() reinterpret_cast( android_atomic_acquire_load(reinterpret_cast(&texture))); m_tilesTextures.append(loadedTexture); + nbLayersTexturesAllocated++; } - XLOG("allocated %d textures", nbTexturesAllocated); + XLOG("allocated %d textures for base (total: %d, %d Mb), %d textures for layers (total: %d, %d Mb)", + nbTexturesAllocated, m_textures.size(), + m_textures.size() * TILE_WIDTH * TILE_HEIGHT * 4 / 1024 / 1024, + nbLayersTexturesAllocated, m_tilesTextures.size(), + m_tilesTextures.size() * LAYER_TILE_WIDTH * LAYER_TILE_HEIGHT * 4 / 1024 / 1024); } void TilesManager::printTextures() -- cgit v1.1