From 572d4bc071578edb62a71d787a4c20124b755f16 Mon Sep 17 00:00:00 2001 From: William Todd Stinson Date: Thu, 11 Oct 2012 16:47:16 -0700 Subject: MAINT-1684: Attempt at correcting the linux crash on startup. Replacing the memory allocations and frees in the LLPrivateMemoryPool with aligned memory allocations and frees. --- indra/llcommon/llmemory.cpp | 31 ++++++++----------------------- 1 file changed, 8 insertions(+), 23 deletions(-) diff --git a/indra/llcommon/llmemory.cpp b/indra/llcommon/llmemory.cpp index afaf366668..eaa7b58e08 100644 --- a/indra/llcommon/llmemory.cpp +++ b/indra/llcommon/llmemory.cpp @@ -252,21 +252,6 @@ U32 LLMemory::getAllocatedMemKB() return sAllocatedMemInKB ; } -void* ll_allocate (size_t size) -{ - if (size == 0) - { - llwarns << "Null allocation" << llendl; - } - void *p = malloc(size); - if (p == NULL) - { - LLMemory::freeReserve(); - llerrs << "Out of memory Error" << llendl; - } - return p; -} - //---------------------------------------------------------------------------- #if defined(LL_WINDOWS) @@ -1365,7 +1350,7 @@ char* LLPrivateMemoryPool::allocate(U32 size) //if the asked size larger than MAX_BLOCK_SIZE, fetch from heap directly, the pool does not manage it if(size >= CHUNK_SIZE) { - return (char*)malloc(size) ; + return (char*)ll_aligned_malloc_16(size) ; } char* p = NULL ; @@ -1422,7 +1407,7 @@ char* LLPrivateMemoryPool::allocate(U32 size) to_log = false ; } - return (char*)malloc(size) ; + return (char*)ll_aligned_malloc_16(size) ; } return p ; @@ -1441,7 +1426,7 @@ void LLPrivateMemoryPool::freeMem(void* addr) if(!chunk) { - free(addr) ; //release from heap + ll_aligned_free(addr) ; //release from heap } else { @@ -1565,7 +1550,7 @@ LLPrivateMemoryPool::LLMemoryChunk* LLPrivateMemoryPool::addChunk(S32 chunk_inde mReservedPoolSize += preferred_size + overhead ; - char* buffer = (char*)malloc(preferred_size + overhead) ; + char* buffer = (char*)ll_aligned_malloc_16(preferred_size + overhead) ; if(!buffer) { return NULL ; @@ -1633,7 +1618,7 @@ void LLPrivateMemoryPool::removeChunk(LLMemoryChunk* chunk) mReservedPoolSize -= chunk->getBufferSize() ; //release memory - free(chunk->getBuffer()) ; + ll_aligned_free(chunk->getBuffer()) ; } U16 LLPrivateMemoryPool::findHashKey(const char* addr) @@ -1977,7 +1962,7 @@ char* LLPrivateMemoryPoolManager::allocate(LLPrivateMemoryPool* poolp, U32 size, if(!poolp) { - p = (char*)malloc(size) ; + p = (char*)ll_aligned_malloc_16(size) ; } else { @@ -2006,7 +1991,7 @@ char* LLPrivateMemoryPoolManager::allocate(LLPrivateMemoryPool* poolp, U32 size) } else { - return (char*)malloc(size) ; + return (char*)ll_aligned_malloc_16(size) ; } } #endif @@ -2031,7 +2016,7 @@ void LLPrivateMemoryPoolManager::freeMem(LLPrivateMemoryPool* poolp, void* addr { if(!sPrivatePoolEnabled) { - free(addr) ; //private pool is disabled. + ll_aligned_free(addr) ; //private pool is disabled. } else if(!sInstance) //the private memory manager is destroyed, try the dangling list { -- cgit v1.2.3 From e1bc3cb096414493203763301314566709cff8bd Mon Sep 17 00:00:00 2001 From: William Todd Stinson Date: Thu, 11 Oct 2012 18:25:13 -0700 Subject: MAINT-1684: Correcting the calls to ll_aligned_free() which should have actually been to ll_aligned_free_16(). --- indra/llcommon/llmemory.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/indra/llcommon/llmemory.cpp b/indra/llcommon/llmemory.cpp index eaa7b58e08..70ad10ad55 100644 --- a/indra/llcommon/llmemory.cpp +++ b/indra/llcommon/llmemory.cpp @@ -1426,7 +1426,7 @@ void LLPrivateMemoryPool::freeMem(void* addr) if(!chunk) { - ll_aligned_free(addr) ; //release from heap + ll_aligned_free_16(addr) ; //release from heap } else { @@ -1618,7 +1618,7 @@ void LLPrivateMemoryPool::removeChunk(LLMemoryChunk* chunk) mReservedPoolSize -= chunk->getBufferSize() ; //release memory - ll_aligned_free(chunk->getBuffer()) ; + ll_aligned_free_16(chunk->getBuffer()) ; } U16 LLPrivateMemoryPool::findHashKey(const char* addr) @@ -2016,7 +2016,7 @@ void LLPrivateMemoryPoolManager::freeMem(LLPrivateMemoryPool* poolp, void* addr { if(!sPrivatePoolEnabled) { - ll_aligned_free(addr) ; //private pool is disabled. + ll_aligned_free_16(addr) ; //private pool is disabled. } else if(!sInstance) //the private memory manager is destroyed, try the dangling list { -- cgit v1.2.3 From d18d3684a81b9196528c7c50b0437c319eb035c2 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Fri, 12 Oct 2012 17:51:49 -0400 Subject: tag merge of DRTVWR-227 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 2e18ba2d59..b4a4ed60ed 100644 --- a/.hgtags +++ b/.hgtags @@ -318,3 +318,4 @@ f00068a66a2e2f72acbe3f690b98b323e740b289 DRTVWR-222 dd23d4da3bcb2ffda58569e759feb7c119982973 DRTVWR-224 0bd3744ff060452aa13ff4992eafb381df7b1012 3.4.1-beta5 29075f8c1abed53dcf195a59f61744e27a91108f DRTVWR-226 +468ca3268229011a59df99229b24315844b33d34 DRTVWR-227 -- cgit v1.2.3 From 5ad21254deb581be413bc57c11cd2a0f698cf2b8 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Fri, 12 Oct 2012 17:53:23 -0400 Subject: Added tag 3.4.1-beta7 for changeset 524da902713e --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 5d91731dfb..dcf7a4fc99 100644 --- a/.hgtags +++ b/.hgtags @@ -320,3 +320,4 @@ dd23d4da3bcb2ffda58569e759feb7c119982973 DRTVWR-224 fba99f381b8d4ad1b7b42fa4993b29998d95be18 DRTVWR-179 49ed253c80bed7410e238eeab35a9f14cb034364 3.4.1-beta6 468ca3268229011a59df99229b24315844b33d34 DRTVWR-227 +524da902713e8b60322640b9825101add4a7c497 3.4.1-beta7 -- cgit v1.2.3 From c97730988eccf10ce8a93e3f564d2b248b17abc8 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Mon, 15 Oct 2012 15:59:41 -0500 Subject: MAINT-1721 Fix for crash when clicking "back" button after editing appearance. Reviewed by VoidPointer --- indra/llimage/llimage.cpp | 6 ++++++ indra/llimage/llimage.h | 2 +- indra/newview/lltexlayer.cpp | 8 +++++++- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/indra/llimage/llimage.cpp b/indra/llimage/llimage.cpp index 6775b005f4..825878c5ef 100644 --- a/indra/llimage/llimage.cpp +++ b/indra/llimage/llimage.cpp @@ -1660,6 +1660,12 @@ static void avg4_colors2(const U8* a, const U8* b, const U8* c, const U8* d, U8* dst[1] = (U8)(((U32)(a[1]) + b[1] + c[1] + d[1])>>2); } +void LLImageBase::setDataAndSize(U8 *data, S32 size) +{ + ll_assert_aligned(data, 16); + mData = data; mDataSize = size; +} + //static void LLImageBase::generateMip(const U8* indata, U8* mipdata, S32 width, S32 height, S32 nchannels) { diff --git a/indra/llimage/llimage.h b/indra/llimage/llimage.h index 46e6d1a901..9ce77a0d01 100644 --- a/indra/llimage/llimage.h +++ b/indra/llimage/llimage.h @@ -148,7 +148,7 @@ public: protected: // special accessor to allow direct setting of mData and mDataSize by LLImageFormatted - void setDataAndSize(U8 *data, S32 size) { mData = data; mDataSize = size; } + void setDataAndSize(U8 *data, S32 size); public: static void generateMip(const U8 *indata, U8* mipdata, int width, int height, S32 nchannels); diff --git a/indra/newview/lltexlayer.cpp b/indra/newview/lltexlayer.cpp index 467115c928..ad09af6594 100644 --- a/indra/newview/lltexlayer.cpp +++ b/indra/newview/lltexlayer.cpp @@ -510,7 +510,13 @@ void LLTexLayerSetBuffer::doUpload() BOOL valid = FALSE; LLPointer integrity_test = new LLImageJ2C; S32 file_size = 0; - U8* data = LLVFile::readFile(gVFS, asset_id, LLAssetType::AT_TEXTURE, &file_size); + + //data buffer MUST be allocated using LLImageBase + LLVFile file(gVFS, asset_id, LLAssetType::AT_TEXTURE); + file_size = file.getSize(); + U8* data = integrity_test->allocateData(file_size); + file.read(data, file_size); + if (data) { valid = integrity_test->validate(data, file_size); // integrity_test will delete 'data' -- cgit v1.2.3 From ab9debd9944e690421a098ec49a7974ad88b40e3 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Mon, 15 Oct 2012 23:18:55 -0400 Subject: tag merge of DRTVWR-228 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index dcf7a4fc99..1f1b26194b 100644 --- a/.hgtags +++ b/.hgtags @@ -321,3 +321,4 @@ fba99f381b8d4ad1b7b42fa4993b29998d95be18 DRTVWR-179 49ed253c80bed7410e238eeab35a9f14cb034364 3.4.1-beta6 468ca3268229011a59df99229b24315844b33d34 DRTVWR-227 524da902713e8b60322640b9825101add4a7c497 3.4.1-beta7 +173c2809f9873499c4b9d6bc044ec941c954d3fb DRTVWR-228 -- cgit v1.2.3 From a7f6dcaef7fb49901a2ebf0629e3089fa8cdad98 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Mon, 15 Oct 2012 23:19:06 -0400 Subject: Added tag 3.4.1-beta8 for changeset 1dc94555582f --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 1f1b26194b..b9c59588e1 100644 --- a/.hgtags +++ b/.hgtags @@ -322,3 +322,4 @@ fba99f381b8d4ad1b7b42fa4993b29998d95be18 DRTVWR-179 468ca3268229011a59df99229b24315844b33d34 DRTVWR-227 524da902713e8b60322640b9825101add4a7c497 3.4.1-beta7 173c2809f9873499c4b9d6bc044ec941c954d3fb DRTVWR-228 +1dc94555582f52718834081e7659e973ae4521f7 3.4.1-beta8 -- cgit v1.2.3 From 7021e4b21b3f2ec7007f34f94bc9825949722d5b Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Tue, 16 Oct 2012 16:07:25 -0400 Subject: change to force new build number --- BuildParams | 1 + 1 file changed, 1 insertion(+) diff --git a/BuildParams b/BuildParams index bdb9d5439d..f523f03117 100644 --- a/BuildParams +++ b/BuildParams @@ -58,6 +58,7 @@ viewer-release.build_debug_release_separately = true viewer-release.build_viewer_update_version_manager = true viewer-release.codeticket_add_context = false + # ======================================== # mesh-development # ======================================== -- cgit v1.2.3