diff --git a/indra/llcommon/llsd.cpp b/indra/llcommon/llsd.cpp
index 151eb4084a853f0119ccc00ce8fb3f489f2e0ab6..e295e3c621d7788fc6ac1475fe57965e7da463a9 100644
--- a/indra/llcommon/llsd.cpp
+++ b/indra/llcommon/llsd.cpp
@@ -54,23 +54,17 @@ namespace
 using namespace LLSDUnnamedNamespace;
 #endif
 
-
-// Normally undefined
-#ifdef LLSD_DEBUG_INFO
+namespace llsd
+{
 
 // statics
-S32	LLSD::sLLSDAllocationCount = 0;
-S32 LLSD::sLLSDNetObjects = 0;
-
-#define	ALLOC_LLSD_OBJECT			{ sLLSDNetObjects++;	sLLSDAllocationCount++;		}
-#define	FREE_LLSD_OBJECT			{ sLLSDNetObjects--;								}
+S32	sLLSDAllocationCount = 0;
+S32 sLLSDNetObjects = 0;
 
-#else
+} // namespace llsd
 
-#define	ALLOC_LLSD_OBJECT
-#define	FREE_LLSD_OBJECT
-
-#endif
+#define	ALLOC_LLSD_OBJECT			{ llsd::sLLSDNetObjects++;	llsd::sLLSDAllocationCount++;	}
+#define	FREE_LLSD_OBJECT			{ llsd::sLLSDNetObjects--;									}
 
 class LLSD::Impl
 	/**< This class is the abstract base class of the implementation of LLSD
@@ -158,6 +152,8 @@ class LLSD::Impl
 		safe(llsd.impl).calcStats(type_counts, share_counts);
 	}
 
+	static const Impl& getImpl(const LLSD& llsd)	{ return safe(llsd.impl); }
+	static Impl& getImpl(LLSD& llsd)				{ return safe(llsd.impl); }
 
 	static const LLSD& undef();
 	
@@ -452,10 +448,8 @@ namespace
 	{
 		std::cout << "Map size: " << mData.size() << std::endl;
 
-		#ifdef LLSD_DEBUG_INFO
-		std::cout << "LLSD Net Objects: " << LLSD::sLLSDNetObjects << std::endl;
-		std::cout << "LLSD allocations: " << LLSD::sLLSDAllocationCount << std::endl;
-		#endif
+		std::cout << "LLSD Net Objects: " << llsd::sLLSDNetObjects << std::endl;
+		std::cout << "LLSD allocations: " << llsd::sLLSDAllocationCount << std::endl;
 
 		std::cout << "LLSD::Impl Net Objects: " << sOutstandingCount << std::endl;
 		std::cout << "LLSD::Impl allocations: " << sAllocationCount << std::endl;
@@ -958,12 +952,10 @@ namespace llsd
 U32 allocationCount()								{ return LLSD::Impl::sAllocationCount; }
 U32 outstandingCount()								{ return LLSD::Impl::sOutstandingCount; }
 
-} // namespace llsd
-
 // Diagnostic dump of contents in an LLSD object
-#ifdef LLSD_DEBUG_INFO
-void LLSD::dumpStats()	const						{ safe(impl).dumpStats();	}
-#endif
+void dumpStats(const LLSD& llsd)					{ LLSD::Impl::getImpl(llsd).dumpStats(); }
+
+} // namespace llsd
 
 // static
 std::string		LLSD::typeString(Type type)
@@ -982,7 +974,7 @@ std::string		LLSD::typeString(Type type)
 		"Array"
 	};
 
-	if (0 <= type && type < (sizeof(sTypeNameArray)/sizeof(sTypeNameArray[0])))
+	if (0 <= type && type < LL_ARRAY_SIZE(sTypeNameArray))
 	{
 		return sTypeNameArray[type];
 	}
diff --git a/indra/llcommon/llsd.h b/indra/llcommon/llsd.h
index ae083dd62966a4ad238e9c3b776a56a6ebcf593a..5eb69059ac6e5f41e4f76504f6d081419652766f 100644
--- a/indra/llcommon/llsd.h
+++ b/indra/llcommon/llsd.h
@@ -401,20 +401,8 @@ class LL_COMMON_API LLSD
 	//@}
 
 public:
-#ifdef LLSD_DEBUG_INFO
-	void			dumpStats() const;					// Output information on object and usage
-#endif
 
 	static std::string		typeString(Type type);		// Return human-readable type as a string
-
-#ifdef LLSD_DEBUG_INFO
-	/// @warn THESE COUNTS WILL NOT BE ACCURATE IN A MULTI-THREADED
-	/// ENVIRONMENT.
-	///
-	/// These counts track LLSD (public) objects.
-	static S32		sLLSDAllocationCount;		// Number of LLSD objects ever created
-	static S32		sLLSDNetObjects;			// Number of LLSD objects that exist
-#endif
 };
 
 struct llsd_select_bool : public std::unary_function<LLSD, LLSD::Boolean>
@@ -465,15 +453,21 @@ LL_COMMON_API std::ostream& operator<<(std::ostream& s, const LLSD& llsd);
 namespace llsd
 {
 
+#ifdef LLSD_DEBUG_INFO
 /** @name Unit Testing Interface */
 //@{
-#ifdef LLSD_DEBUG_INFO
-	/// @warn THESE COUNTS WILL NOT BE ACCURATE IN A MULTI-THREADED
+	LL_COMMON_API void dumpStats(const LLSD&);	///< Output information on object and usage
+
+	/// @warn THE FOLLOWING COUNTS WILL NOT BE ACCURATE IN A MULTI-THREADED
 	/// ENVIRONMENT.
 	///
 	/// These counts track LLSD::Impl (hidden) objects.
 	LL_COMMON_API U32 allocationCount();	///< how many Impls have been made
 	LL_COMMON_API U32 outstandingCount();	///< how many Impls are still alive
+
+	/// These counts track LLSD (public) objects.
+	LL_COMMON_API extern S32 sLLSDAllocationCount;	///< Number of LLSD objects ever created
+	LL_COMMON_API extern S32 sLLSDNetObjects;		///< Number of LLSD objects that exist
 #endif
 //@}