diff --git a/indra/llcommon/CMakeLists.txt b/indra/llcommon/CMakeLists.txt
index e138a54d29259053a0d61869cdedf6e784547bd1..e2e2cb436d71c75f40eb10c66ecdbf5743210bbb 100755
--- a/indra/llcommon/CMakeLists.txt
+++ b/indra/llcommon/CMakeLists.txt
@@ -34,7 +34,7 @@ set(llcommon_SOURCE_FILES
     llassettype.cpp
     llbase32.cpp
     llbase64.cpp
-	llbitpack.cpp
+    llbitpack.cpp
     llcommon.cpp
     llcommonutils.cpp
     llcoros.cpp
@@ -205,7 +205,7 @@ set(llcommon_HEADER_FILES
     llthreadsafequeue.h
     lltimer.h
     lltrace.h
-	lltraceaccumulators.h
+    lltraceaccumulators.h
     lltracerecording.h
     lltracethreadrecorder.h
     lltreeiterators.h
@@ -213,7 +213,7 @@ set(llcommon_HEADER_FILES
     llunittype.h
     lluri.h
     lluuid.h
-	llwin32headers.h
+    llwin32headers.h
     llwin32headerslean.h
     llworkerthread.h
     stdtypes.h
diff --git a/indra/llcommon/indra_constants.cpp b/indra/llcommon/indra_constants.cpp
index b61dca32434bd2e0adf65063cb78bf29470fdc57..f3989ee1d06ffd4e19733e0c087745f80a0cc154 100755
--- a/indra/llcommon/indra_constants.cpp
+++ b/indra/llcommon/indra_constants.cpp
@@ -66,4 +66,4 @@ const LLUUID TERRAIN_GRASS_DETAIL		("63338ede-0037-c4fd-855b-015d77112fc8"); //
 const LLUUID TERRAIN_MOUNTAIN_DETAIL	("303cd381-8560-7579-23f1-f0a880799740"); // VIEWER
 const LLUUID TERRAIN_ROCK_DETAIL		("53a2f406-4895-1d13-d541-d2e3b86bc19c"); // VIEWER
 
-const LLUUID DEFAULT_WATER_NORMAL		("822ded49-9a6c-f61c-cb89-6df54f42cdf4"); // VIEWER
\ No newline at end of file
+const LLUUID DEFAULT_WATER_NORMAL		("822ded49-9a6c-f61c-cb89-6df54f42cdf4"); // VIEWER
diff --git a/indra/llcommon/lltrace.cpp b/indra/llcommon/lltrace.cpp
index e4a6f4c9027602e48c1a4b406f851a3ee4f71dba..73846ba9009afa2d96a36229e69b3270fd902b46 100644
--- a/indra/llcommon/lltrace.cpp
+++ b/indra/llcommon/lltrace.cpp
@@ -33,6 +33,8 @@
 namespace LLTrace
 {
 
+MemStatHandle gTraceMemStat("LLTrace");
+
 TraceBase::TraceBase( const char* name, const char* description ) 
 :	mName(name),
 	mDescription(description ? description : "")
diff --git a/indra/llcommon/lltrace.h b/indra/llcommon/lltrace.h
index 226f64d0c77a289fa03ba7a00cd6f49ece762802..3dc2e5248f4e7c9643b237ba36e352de8aa5315d 100644
--- a/indra/llcommon/lltrace.h
+++ b/indra/llcommon/lltrace.h
@@ -320,23 +320,23 @@ struct MeasureMem<std::basic_string<T>, IS_MEM_TRACKABLE, IS_BYTES>
 
 
 template<typename T>
-inline void claim_footprint(MemStatHandle& measurement, const T& value)
+inline void claim_alloc(MemStatHandle& measurement, const T& value)
 {
 	S32 size = MeasureMem<T>::measureFootprint(value);
 	if(size == 0) return;
 	MemStatAccumulator& accumulator = measurement.getCurrentAccumulator();
 	accumulator.mSize.sample(accumulator.mSize.hasValue() ? accumulator.mSize.getLastValue() + (F64)size : (F64)size);
-	accumulator.mFootprintAllocations.record(size);
+	accumulator.mAllocations.record(size);
 }
 
 template<typename T>
-inline void disclaim_footprint(MemStatHandle& measurement, const T& value)
+inline void disclaim_alloc(MemStatHandle& measurement, const T& value)
 {
 	S32 size = MeasureMem<T>::measureFootprint(value);
 	if(size == 0) return;
 	MemStatAccumulator& accumulator = measurement.getCurrentAccumulator();
 	accumulator.mSize.sample(accumulator.mSize.hasValue() ? accumulator.mSize.getLastValue() - (F64)size : -(F64)size);
-	accumulator.mFootprintDeallocations.add(size);
+	accumulator.mDeallocations.add(size);
 }
 
 template<typename DERIVED, size_t ALIGNMENT = LL_DEFAULT_HEAP_ALIGN>
@@ -370,25 +370,25 @@ class MemTrackable
 
 	void* operator new(size_t size) 
 	{
-		claim_footprint(sMemStat, size);
+		claim_alloc(sMemStat, size);
 		return ll_aligned_malloc(ALIGNMENT, size);
 	}
 
 	void operator delete(void* ptr, size_t size)
 	{
-		disclaim_footprint(sMemStat, size);
+		disclaim_alloc(sMemStat, size);
 		ll_aligned_free(ALIGNMENT, ptr);
 	}
 
 	void* operator new [](size_t size)
 	{
-		claim_footprint(sMemStat, size);
+		claim_alloc(sMemStat, size);
 		return ll_aligned_malloc(ALIGNMENT, size);
 	}
 
 	void operator delete[](void* ptr, size_t size)
 	{
-		disclaim_footprint(sMemStat, size);
+		disclaim_alloc(sMemStat, size);
 		ll_aligned_free(ALIGNMENT, ptr);
 	}
 
@@ -397,7 +397,7 @@ class MemTrackable
 	void claimMem(const CLAIM_T& value) const
 	{
 		S32 size = MeasureMem<CLAIM_T>::measureFootprint(value);
-		claim_footprint(sMemStat, size);
+		claim_alloc(sMemStat, size);
 		mMemFootprint += size;
 	}
 
@@ -406,7 +406,7 @@ class MemTrackable
 	void disclaimMem(const CLAIM_T& value) const
 	{
 		S32 size = MeasureMem<CLAIM_T>::measureFootprint(value);
-		disclaim_footprint(sMemStat, size);
+		disclaim_alloc(sMemStat, size);
 		mMemFootprint -= size;
 	}
 
diff --git a/indra/llcommon/lltraceaccumulators.cpp b/indra/llcommon/lltraceaccumulators.cpp
index f5f2e7df1c26d782e9b8bedc45ef9782ac65b156..c25bb704f5866e6665dffd05a7e6cfbec7740bb2 100644
--- a/indra/llcommon/lltraceaccumulators.cpp
+++ b/indra/llcommon/lltraceaccumulators.cpp
@@ -26,18 +26,50 @@
 #include "linden_common.h"
 
 #include "lltraceaccumulators.h"
+#include "lltrace.h"
 #include "lltracethreadrecorder.h"
 
 namespace LLTrace
 {
 
+extern MemStatHandle gTraceMemStat;
+
 
 ///////////////////////////////////////////////////////////////////////
 // AccumulatorBufferGroup
 ///////////////////////////////////////////////////////////////////////
 
 AccumulatorBufferGroup::AccumulatorBufferGroup() 
-{}
+{
+	claim_alloc(gTraceMemStat, mCounts.capacity() * sizeof(CountAccumulator));
+	claim_alloc(gTraceMemStat, mSamples.capacity() * sizeof(SampleAccumulator));
+	claim_alloc(gTraceMemStat, mEvents.capacity() * sizeof(EventAccumulator));
+	claim_alloc(gTraceMemStat, mStackTimers.capacity() * sizeof(TimeBlockAccumulator));
+	claim_alloc(gTraceMemStat, mMemStats.capacity() * sizeof(MemStatAccumulator));
+}
+
+AccumulatorBufferGroup::AccumulatorBufferGroup(const AccumulatorBufferGroup& other)
+:	mCounts(other.mCounts),
+	mSamples(other.mSamples),
+	mEvents(other.mEvents),
+	mStackTimers(other.mStackTimers),
+	mMemStats(other.mMemStats)
+{
+	claim_alloc(gTraceMemStat, mCounts.capacity() * sizeof(CountAccumulator));
+	claim_alloc(gTraceMemStat, mSamples.capacity() * sizeof(SampleAccumulator));
+	claim_alloc(gTraceMemStat, mEvents.capacity() * sizeof(EventAccumulator));
+	claim_alloc(gTraceMemStat, mStackTimers.capacity() * sizeof(TimeBlockAccumulator));
+	claim_alloc(gTraceMemStat, mMemStats.capacity() * sizeof(MemStatAccumulator));
+}
+
+AccumulatorBufferGroup::~AccumulatorBufferGroup()
+{
+	disclaim_alloc(gTraceMemStat, mCounts.capacity() * sizeof(CountAccumulator));
+	disclaim_alloc(gTraceMemStat, mSamples.capacity() * sizeof(SampleAccumulator));
+	disclaim_alloc(gTraceMemStat, mEvents.capacity() * sizeof(EventAccumulator));
+	disclaim_alloc(gTraceMemStat, mStackTimers.capacity() * sizeof(TimeBlockAccumulator));
+	disclaim_alloc(gTraceMemStat, mMemStats.capacity() * sizeof(MemStatAccumulator));
+}
 
 void AccumulatorBufferGroup::handOffTo(AccumulatorBufferGroup& other)
 {
diff --git a/indra/llcommon/lltraceaccumulators.h b/indra/llcommon/lltraceaccumulators.h
index ecc569f5d63afd075cd2587e31dabd66ceba6666..27c0910665b1d0aa845797a30c42cedb7db3152a 100644
--- a/indra/llcommon/lltraceaccumulators.h
+++ b/indra/llcommon/lltraceaccumulators.h
@@ -188,6 +188,11 @@ namespace LLTrace
 			return getNumIndices();
 		}
 
+		size_t capacity() const
+		{
+			return mStorageSize;
+		}
+
 		static size_t getNumIndices() 
 		{
 			return sNextStorageSlot;
@@ -261,8 +266,8 @@ namespace LLTrace
 		void sync(F64SecondsImplicit) {}
 
 		F64	getSum() const               { return mSum; }
-		F64	getMin() const               { return mMin; }
-		F64	getMax() const               { return mMax; }
+		F32	getMin() const               { return mMin; }
+		F32	getMax() const               { return mMax; }
 		F64	getLastValue() const         { return mLastValue; }
 		F64	getMean() const              { return mMean; }
 		F64 getStandardDeviation() const { return sqrtf(mSumOfSquares / mNumSamples); }
@@ -272,13 +277,14 @@ namespace LLTrace
 
 	private:
 		F64	mSum,
-			mMin,
-			mMax,
 			mLastValue;
 
 		F64	mMean,
 			mSumOfSquares;
 
+		F32 mMin,
+			mMax;
+
 		S32	mNumSamples;
 	};
 
@@ -345,8 +351,8 @@ namespace LLTrace
 		}
 
 		F64	getSum() const               { return mSum; }
-		F64	getMin() const               { return mMin; }
-		F64	getMax() const               { return mMax; }
+		F32	getMin() const               { return mMin; }
+		F32	getMax() const               { return mMax; }
 		F64	getLastValue() const         { return mLastValue; }
 		F64	getMean() const              { return mMean; }
 		F64 getStandardDeviation() const { return sqrtf(mSumOfSquares / mTotalSamplingTime); }
@@ -357,12 +363,8 @@ namespace LLTrace
 
 	private:
 		F64		mSum,
-				mMin,
-				mMax,
 				mLastValue;
 
-		bool	mHasValue;		// distinct from mNumSamples, since we might have inherited an old sample
-
 		F64		mMean,
 				mSumOfSquares;
 
@@ -370,7 +372,13 @@ namespace LLTrace
 				mLastSampleTimeStamp,
 				mTotalSamplingTime;
 
+		F32		mMin,
+				mMax;
+
 		S32		mNumSamples;
+		// distinct from mNumSamples, since we might have inherited a last value from
+		// a previous sampling period
+		bool	mHasValue;		
 	};
 
 	class CountAccumulator
@@ -500,8 +508,8 @@ namespace LLTrace
 
 		void addSamples(const MemStatAccumulator& other, EBufferAppendType append_type)
 		{
-			mFootprintAllocations.addSamples(other.mFootprintAllocations, append_type);
-			mFootprintDeallocations.addSamples(other.mFootprintDeallocations, append_type);
+			mAllocations.addSamples(other.mAllocations, append_type);
+			mDeallocations.addSamples(other.mDeallocations, append_type);
 
 			if (append_type == SEQUENTIAL)
 			{
@@ -509,7 +517,7 @@ namespace LLTrace
 			}
 			else
 			{
-				F64 allocation_delta(other.mFootprintAllocations.getSum() - other.mFootprintDeallocations.getSum());
+				F64 allocation_delta(other.mAllocations.getSum() - other.mDeallocations.getSum());
 				mSize.sample(mSize.hasValue() 
 					? mSize.getLastValue() + allocation_delta 
 					: allocation_delta);
@@ -519,8 +527,8 @@ namespace LLTrace
 		void reset(const MemStatAccumulator* other)
 		{
 			mSize.reset(other ? &other->mSize : NULL);
-			mFootprintAllocations.reset(other ? &other->mFootprintAllocations : NULL);
-			mFootprintDeallocations.reset(other ? &other->mFootprintDeallocations : NULL);
+			mAllocations.reset(other ? &other->mAllocations : NULL);
+			mDeallocations.reset(other ? &other->mDeallocations : NULL);
 		}
 
 		void sync(F64SecondsImplicit time_stamp) 
@@ -529,13 +537,15 @@ namespace LLTrace
 		}
 
 		SampleAccumulator	mSize;
-		EventAccumulator	mFootprintAllocations;
-		CountAccumulator	mFootprintDeallocations;
+		EventAccumulator	mAllocations;
+		CountAccumulator	mDeallocations;
 	};
 
 	struct AccumulatorBufferGroup : public LLRefCount
 	{
 		AccumulatorBufferGroup();
+		AccumulatorBufferGroup(const AccumulatorBufferGroup&);
+		~AccumulatorBufferGroup();
 
 		void handOffTo(AccumulatorBufferGroup& other);
 		void makeCurrent();
diff --git a/indra/llcommon/lltracerecording.cpp b/indra/llcommon/lltracerecording.cpp
index ce4a433ccae6a019f178aef2cb782a80aaa355a0..06b43513395586a3bc18cb9971e55521db9bda4f 100644
--- a/indra/llcommon/lltracerecording.cpp
+++ b/indra/llcommon/lltracerecording.cpp
@@ -25,15 +25,18 @@
 
 #include "linden_common.h"
 
+#include "lltracerecording.h"
+
 #include "lltrace.h"
 #include "llfasttimer.h"
-#include "lltracerecording.h"
 #include "lltracethreadrecorder.h"
 #include "llthread.h"
 
 namespace LLTrace
 {
-	
+
+extern MemStatHandle gTraceMemStat;
+
 ///////////////////////////////////////////////////////////////////////
 // Recording
 ///////////////////////////////////////////////////////////////////////
@@ -42,12 +45,15 @@ Recording::Recording(EPlayState state)
 :	mElapsedSeconds(0),
 	mInHandOff(false)
 {
+	claim_alloc(gTraceMemStat, this);
 	mBuffers = new AccumulatorBufferGroup();
+	claim_alloc(gTraceMemStat, mBuffers);
 	setPlayState(state);
 }
 
 Recording::Recording( const Recording& other )
 {
+	claim_alloc(gTraceMemStat, this);
 	*this = other;
 }
 
@@ -73,6 +79,9 @@ Recording& Recording::operator = (const Recording& other)
 
 Recording::~Recording()
 {
+	disclaim_alloc(gTraceMemStat, this);
+	disclaim_alloc(gTraceMemStat, mBuffers);
+
 	if (isStarted() && LLTrace::get_thread_recorder().notNull())
 	{
 		LLTrace::get_thread_recorder()->deactivate(mBuffers.write());
@@ -200,32 +209,32 @@ F64Kilobytes Recording::getLastValue(const TraceType<MemStatAccumulator>& stat)
 
 F64Kilobytes Recording::getSum(const TraceType<MemStatAccumulator::AllocationFacet>& stat)
 {
-	return F64Bytes(mBuffers->mMemStats[stat.getIndex()].mFootprintAllocations.getSum());
+	return F64Bytes(mBuffers->mMemStats[stat.getIndex()].mAllocations.getSum());
 }
 
 F64Kilobytes Recording::getPerSec(const TraceType<MemStatAccumulator::AllocationFacet>& stat)
 {
-	return F64Bytes(mBuffers->mMemStats[stat.getIndex()].mFootprintAllocations.getSum() / mElapsedSeconds.value());
+	return F64Bytes(mBuffers->mMemStats[stat.getIndex()].mAllocations.getSum() / mElapsedSeconds.value());
 }
 
 S32 Recording::getSampleCount(const TraceType<MemStatAccumulator::AllocationFacet>& stat)
 {
-	return mBuffers->mMemStats[stat.getIndex()].mFootprintAllocations.getSampleCount();
+	return mBuffers->mMemStats[stat.getIndex()].mAllocations.getSampleCount();
 }
 
 F64Kilobytes Recording::getSum(const TraceType<MemStatAccumulator::DeallocationFacet>& stat)
 {
-	return F64Bytes(mBuffers->mMemStats[stat.getIndex()].mFootprintDeallocations.getSum());
+	return F64Bytes(mBuffers->mMemStats[stat.getIndex()].mDeallocations.getSum());
 }
 
 F64Kilobytes Recording::getPerSec(const TraceType<MemStatAccumulator::DeallocationFacet>& stat)
 {
-	return F64Bytes(mBuffers->mMemStats[stat.getIndex()].mFootprintDeallocations.getSum() / mElapsedSeconds.value());
+	return F64Bytes(mBuffers->mMemStats[stat.getIndex()].mDeallocations.getSum() / mElapsedSeconds.value());
 }
 
 S32 Recording::getSampleCount(const TraceType<MemStatAccumulator::DeallocationFacet>& stat)
 {
-	return mBuffers->mMemStats[stat.getIndex()].mFootprintDeallocations.getSampleCount();
+	return mBuffers->mMemStats[stat.getIndex()].mDeallocations.getSampleCount();
 }
 
 F64 Recording::getSum( const TraceType<CountAccumulator>& stat )
@@ -330,6 +339,12 @@ PeriodicRecording::PeriodicRecording( S32 num_periods, EPlayState state)
 	mRecordingPeriods(num_periods ? num_periods : 1)
 {
 	setPlayState(state);
+	claim_alloc(gTraceMemStat, this);
+}
+
+PeriodicRecording::~PeriodicRecording()
+{
+	disclaim_alloc(gTraceMemStat, this);
 }
 
 void PeriodicRecording::nextPeriod()
diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h
index 5cf7596966ffa9681ac7beb14e90b114fdad41fa..8bb0b1892fc16b95a69f4481c7d6839bfc0ce775 100644
--- a/indra/llcommon/lltracerecording.h
+++ b/indra/llcommon/lltracerecording.h
@@ -313,7 +313,7 @@ namespace LLTrace
 		class ThreadRecorder* getThreadRecorder(); 
 
 		LLTimer											mSamplingTimer;
-		F64Seconds					mElapsedSeconds;
+		F64Seconds										mElapsedSeconds;
 		LLCopyOnWritePointer<AccumulatorBufferGroup>	mBuffers;
 		bool											mInHandOff;
 
@@ -324,6 +324,7 @@ namespace LLTrace
 	{
 	public:
 		PeriodicRecording(S32 num_periods, EPlayState state = STOPPED);
+		~PeriodicRecording();
 
 		void nextPeriod();
 		S32 getNumRecordedPeriods() { return mNumPeriods; }
diff --git a/indra/llcommon/lltracethreadrecorder.cpp b/indra/llcommon/lltracethreadrecorder.cpp
index e131af5f160ff758c07db4afcf7856fd2b313702..9dac4f677188de348ea3796e07cfba9b56af7807 100644
--- a/indra/llcommon/lltracethreadrecorder.cpp
+++ b/indra/llcommon/lltracethreadrecorder.cpp
@@ -27,9 +27,11 @@
 
 #include "lltracethreadrecorder.h"
 #include "llfasttimer.h"
+#include "lltrace.h"
 
 namespace LLTrace
 {
+extern MemStatHandle gTraceMemStat;
 
 static ThreadRecorder* sMasterThreadRecorder = NULL;
 
@@ -55,6 +57,7 @@ void ThreadRecorder::init()
 	timer_stack->mActiveTimer = NULL;
 
 	mNumTimeBlockTreeNodes = AccumulatorBuffer<TimeBlockAccumulator>::getDefaultBuffer()->size();
+
 	mTimeBlockTreeNodes = new TimeBlockTreeNode[mNumTimeBlockTreeNodes];
 
 	activate(&mThreadRecordingBuffers);
@@ -76,10 +79,14 @@ void ThreadRecorder::init()
 	timer_stack->mActiveTimer = mRootTimer;
 
 	TimeBlock::getRootTimeBlock().getCurrentAccumulator().mActiveCount = 1;
+
+	claim_alloc(gTraceMemStat, this);
+	claim_alloc(gTraceMemStat, sizeof(BlockTimer));
+	claim_alloc(gTraceMemStat, sizeof(TimeBlockTreeNode) * mNumTimeBlockTreeNodes);
 }
 
 
-ThreadRecorder::ThreadRecorder(ThreadRecorder& master)
+ThreadRecorder::ThreadRecorder( ThreadRecorder& master )
 :	mMasterRecorder(&master)
 {
 	init();
@@ -91,6 +98,10 @@ ThreadRecorder::~ThreadRecorder()
 {
 	LLThreadLocalSingletonPointer<BlockTimerStackRecord>::setInstance(NULL);
 
+	disclaim_alloc(gTraceMemStat, this);
+	disclaim_alloc(gTraceMemStat, sizeof(BlockTimer));
+	disclaim_alloc(gTraceMemStat, sizeof(TimeBlockTreeNode) * mNumTimeBlockTreeNodes);
+
 	deactivate(&mThreadRecordingBuffers);
 
 	delete mRootTimer;
@@ -135,9 +146,9 @@ void ThreadRecorder::activate( AccumulatorBufferGroup* recording, bool from_hand
 	mActiveRecordings.back()->mPartialRecording.makeCurrent();
 }
 
-ThreadRecorder::active_recording_list_t::reverse_iterator ThreadRecorder::bringUpToDate( AccumulatorBufferGroup* recording )
+ThreadRecorder::active_recording_list_t::iterator ThreadRecorder::bringUpToDate( AccumulatorBufferGroup* recording )
 {
-	if (mActiveRecordings.empty()) return mActiveRecordings.rend();
+	if (mActiveRecordings.empty()) return mActiveRecordings.end();
 
 	mActiveRecordings.back()->mPartialRecording.sync();
 	TimeBlock::updateTimes();
@@ -174,19 +185,18 @@ ThreadRecorder::active_recording_list_t::reverse_iterator ThreadRecorder::bringU
 		LL_WARNS() << "Recording not active on this thread" << LL_ENDL;
 	}
 
-	return it;
+	return (++it).base();
 }
 
 void ThreadRecorder::deactivate( AccumulatorBufferGroup* recording )
 {
-	active_recording_list_t::reverse_iterator it = bringUpToDate(recording);
-	if (it != mActiveRecordings.rend())
+	active_recording_list_t::iterator recording_it = bringUpToDate(recording);
+	if (recording_it != mActiveRecordings.end())
 	{
-		active_recording_list_t::iterator recording_to_remove = (++it).base();
-		bool was_current = (*recording_to_remove)->mPartialRecording.isCurrent();
-		llassert((*recording_to_remove)->mTargetRecording == recording);
-		delete *recording_to_remove;
-		mActiveRecordings.erase(recording_to_remove);
+		ActiveRecording* recording_to_remove = *recording_it;
+		bool was_current = recording_to_remove->mPartialRecording.isCurrent();
+		llassert(recording_to_remove->mTargetRecording == recording);
+		mActiveRecordings.erase(recording_it);
 		if (was_current)
 		{
 			if (mActiveRecordings.empty())
@@ -198,6 +208,7 @@ void ThreadRecorder::deactivate( AccumulatorBufferGroup* recording )
 				mActiveRecordings.back()->mPartialRecording.makeCurrent();
 			}
 		}
+		delete recording_to_remove;
 	}
 }
 
@@ -216,25 +227,33 @@ void ThreadRecorder::ActiveRecording::movePartialToTarget()
 
 // called by child thread
 void ThreadRecorder::addChildRecorder( class ThreadRecorder* child )
-{ LLMutexLock lock(&mChildListMutex);
-	mChildThreadRecorders.push_back(child);
+{
+	{ LLMutexLock lock(&mChildListMutex);
+		mChildThreadRecorders.push_back(child);
+	}
 }
 
 // called by child thread
 void ThreadRecorder::removeChildRecorder( class ThreadRecorder* child )
-{ LLMutexLock lock(&mChildListMutex);
-
-for (child_thread_recorder_list_t::iterator it = mChildThreadRecorders.begin(), end_it = mChildThreadRecorders.end();
-	it != end_it;
-	++it)
-{
-	if ((*it) == child)
-	{
-		mChildThreadRecorders.erase(it);
-		break;
+{	
+	{ LLMutexLock lock(&mChildListMutex);
+		for (child_thread_recorder_list_t::iterator it = mChildThreadRecorders.begin(), end_it = mChildThreadRecorders.end();
+			it != end_it;
+			++it)
+		{
+			if ((*it) == child)
+			{
+				// FIXME: this won't do any good, as the child stores the "pushed" values internally
+				// and it is in the process of being deleted.
+				// We need a way to finalize the stats from the outgoing thread, but the storage
+				// for those stats needs to be outside the child's thread recorder
+				//(*it)->pushToParent();
+				mChildThreadRecorders.erase(it);
+				break;
+			}
+		}
 	}
 }
-}
 
 void ThreadRecorder::pushToParent()
 {
@@ -269,7 +288,7 @@ void ThreadRecorder::pullFromChildren()
 }
 
 
-void set_master_thread_recorder(ThreadRecorder* recorder)
+void set_master_thread_recorder( ThreadRecorder* recorder )
 {
 	sMasterThreadRecorder = recorder;
 }
@@ -291,7 +310,7 @@ const LLThreadLocalPointer<ThreadRecorder>& get_thread_recorder()
 	return get_thread_recorder_ptr();
 }
 
-void set_thread_recorder(ThreadRecorder* recorder)
+void set_thread_recorder( ThreadRecorder* recorder )
 {
 	get_thread_recorder_ptr() = recorder;
 }
diff --git a/indra/llcommon/lltracethreadrecorder.h b/indra/llcommon/lltracethreadrecorder.h
index c40228785e0c3b7794f5f1068c656a3acd9538e0..c6afcdac804e5cae6ec2593caad5c8e63beff178 100644
--- a/indra/llcommon/lltracethreadrecorder.h
+++ b/indra/llcommon/lltracethreadrecorder.h
@@ -49,7 +49,7 @@ namespace LLTrace
 
 		void activate(AccumulatorBufferGroup* recording, bool from_handoff = false);
 		void deactivate(AccumulatorBufferGroup* recording);
-		active_recording_list_t::reverse_iterator bringUpToDate(AccumulatorBufferGroup* recording);
+		active_recording_list_t::iterator bringUpToDate(AccumulatorBufferGroup* recording);
 
 		void addChildRecorder(class ThreadRecorder* child);
 		void removeChildRecorder(class ThreadRecorder* child);
diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp
index 0cfc11ef195f1961cfb3a160909d049a4cb46b03..968b796d6b34d7b04eefa46f7ece9254dd41c46e 100755
--- a/indra/llrender/llvertexbuffer.cpp
+++ b/indra/llrender/llvertexbuffer.cpp
@@ -1190,7 +1190,7 @@ void LLVertexBuffer::createGLBuffer(U32 size)
 		mMappedData = (U8*)ALLOCATE_MEM(sPrivatePoolp, size);
 		disclaimMem(mSize);
 		mSize = size;
-		disclaimMem(mSize);
+		claimMem(mSize);
 	}
 }
 
@@ -2272,10 +2272,10 @@ void LLVertexBuffer::setBuffer(U32 data_mask)
 
             if (unsatisfied_mask & (1 << TYPE_INDEX))
             {
-               llinfos << "Missing indices" << llendl;
+               LL_INFOS() << "Missing indices" << LL_ENDL;
             }
 
-				llerrs << "Shader consumption mismatches data provision." << llendl;
+				LL_ERRS() << "Shader consumption mismatches data provision." << LL_ENDL;
 			}
 		}
 	}
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index 14e96a06cc554adccac0ed0dfdb7c5e266ae7fc2..435dddda7718f0670d348de2753b0c4508dd7f55 100755
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -2994,6 +2994,17 @@
 	  <key>Value</key>
 	  <string>Female Shape &amp; Outfit</string>
 	</map>
+	<key>DefaultLoginLocation</key>
+	<map>
+		<key>Comment</key>
+		<string>Startup destination default (if not specified on command line)</string>
+		<key>Persist</key>
+		<integer>1</integer>
+		<key>Type</key>
+		<string>String</string>
+		<key>Value</key>
+		<string/>
+	</map>
 	<key>DefaultMaleAvatar</key>
 	<map>
 	  <key>Comment</key>
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index 1ea428ff039b8ba478131c0da48a805360f41d60..3099a1b74f82eafbf7eff2e61cfb6ceefc4aefeb 100755
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -2653,10 +2653,26 @@ bool LLAppViewer::initConfiguration()
     // What can happen is that someone can use IE (or potentially 
     // other browsers) and do the rough equivalent of command 
     // injection and steal passwords. Phoenix. SL-55321
-	std::string CmdLineLoginLocation(gSavedSettings.getString("CmdLineLoginLocation"));
-	if(! CmdLineLoginLocation.empty())
+
+	std::string starting_location;
+
+	std::string cmd_line_login_location(gSavedSettings.getString("CmdLineLoginLocation"));
+	if(! cmd_line_login_location.empty())
+	{
+		starting_location = cmd_line_login_location;
+	}
+	else
+	{
+		std::string default_login_location(gSavedSettings.getString("DefaultLoginLocation"));
+		if (! default_login_location.empty())
+		{
+			starting_location = default_login_location;
+		}
+	}
+
+	if (! starting_location.empty())
 	{
-		LLSLURL start_slurl(CmdLineLoginLocation);
+		LLSLURL start_slurl(starting_location);
 		LLStartUp::setStartSLURL(start_slurl);
 		if(start_slurl.getType() == LLSLURL::LOCATION) 
 		{  
diff --git a/indra/newview/llfasttimerview.cpp b/indra/newview/llfasttimerview.cpp
index bbd8f0792a872b9af987260c68de56019bf74316..4809a6b7dabf2c7ddef03ea66df82a75210f248f 100755
--- a/indra/newview/llfasttimerview.cpp
+++ b/indra/newview/llfasttimerview.cpp
@@ -62,7 +62,7 @@ static const S32 MAX_VISIBLE_HISTORY = 12;
 static const S32 LINE_GRAPH_HEIGHT = 240;
 static const S32 MIN_BAR_HEIGHT = 3;
 static const S32 RUNNING_AVERAGE_WIDTH = 100;
-static const S32 NUM_FRAMES_HISTORY = 256;
+static const S32 NUM_FRAMES_HISTORY = 200;
 
 std::vector<TimeBlock*> ft_display_idx; // line of table entry for display purposes (for collapse)
 
diff --git a/indra/newview/llfasttimerview.h b/indra/newview/llfasttimerview.h
index 8c8eb99b59714885f75cfb1f859de7f085334360..672bb5d7cac3f95ba5ae5f83ac940fdc46952306 100755
--- a/indra/newview/llfasttimerview.h
+++ b/indra/newview/llfasttimerview.h
@@ -87,12 +87,12 @@ class LLFastTimerView : public LLFloater
 			mFirstChild(false),
 			mLastChild(false)
 		{}
-		F32Seconds	mTotalTime,
-										mSelfTime,
-										mChildrenStart,
-										mChildrenEnd,
-										mSelfStart,
-										mSelfEnd;
+		F32Seconds			mTotalTime,
+							mSelfTime,
+							mChildrenStart,
+							mChildrenEnd,
+							mSelfStart,
+							mSelfEnd;
 		LLTrace::TimeBlock* mTimeBlock;
 		bool				mVisible,
 							mFirstChild,
diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp
index 39ced906ad4bc6d9cdd3ed0004bcce33305e8d0a..72c76f9424fc8d06a30b4cad2326af7e7901e148 100755
--- a/indra/newview/llstartup.cpp
+++ b/indra/newview/llstartup.cpp
@@ -2176,10 +2176,6 @@ bool idle_startup()
 		// reset keyboard focus to sane state of pointing at world
 		gFocusMgr.setKeyboardFocus(NULL);
 
-#if 0 // sjb: enable for auto-enabling timer display 
-		gDebugView->mFastTimerView->setVisible(TRUE);
-#endif
-
 		LLAppViewer::instance()->handleLoginComplete();
 
 		LLAgentPicksInfo::getInstance()->requestNumberOfPicks();
diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp
index dd80a4f65d4ba272b65baf22481f24cc61aa7acf..f2abadce851efc8654c6e7b6c16467a6ee2abbbd 100755
--- a/indra/newview/llviewerobject.cpp
+++ b/indra/newview/llviewerobject.cpp
@@ -4756,7 +4756,7 @@ bool LLViewerObject::isImageAlphaBlended(const U8 te) const
 		case GL_RGB: break;
 		default:
 		{
-			llwarns << "Unexpected tex format in LLViewerObject::isImageAlphaBlended...returning no alpha." << llendl;
+			LL_WARNS() << "Unexpected tex format in LLViewerObject::isImageAlphaBlended...returning no alpha." << LL_ENDL;
 		}
 		break;
 	}
diff --git a/indra/newview/skins/default/xui/en/floater_stats.xml b/indra/newview/skins/default/xui/en/floater_stats.xml
index d4decf383d00e8cac406f955462ce2fe407ae9a3..b2399123be5fd34ba7947544e9f5c89b55c65168 100755
--- a/indra/newview/skins/default/xui/en/floater_stats.xml
+++ b/indra/newview/skins/default/xui/en/floater_stats.xml
@@ -110,6 +110,9 @@
         </stat_view>
 			 <stat_view name="memory"
 									label="Memory Usage">
+				 <stat_bar name="LLTrace"
+                    label="LLTrace"
+                    stat="LLTrace"/>
 				 <stat_bar name="LLView"
                     label="UI"
                     stat="LLView"/>