Finding leaks


Overview

This page describes a method how to identify memory leaks within the SecondLife viewer using Microsoft's debug memory routines.

Note: If you have questions, please use the discussion page on this wiki topic. (Nicholaz 10:29, 29 June 2007 (PDT))



Identifying Leaks


Modifying the source

Download the memory leak patch from leakdebug.patch and apply it to the source tree via


Compiling

For general compiling instructions, see Microsoft Windows - Visual Studio .NET 2003 or Microsoft Windows - Visual Studio 2005 & Visual C++ 2005 Express.

The patch activates the leak debugging routines through the linden_common.h files and is only activated in the Debug configuration. It should be completely transparent in other configurations like ReleaseNoOpt or ReleaseForDownload.

When compiling, make sure you compile all projects with the /MTd flag

#define LL_LIBXUL_ENABLED  1 (line 59) 

to

#ifndef _DEBUG
	#define LL_LIBXUL_ENABLED		1
#else
	#define LL_LIBXUL_ENABLED		0
#endif


Running


Identifying the source of the leak through leaks.log

Finding leaks is a nice task. Like post mortem debugging in many cases it is puzzle and detective work and the leaks.log file is your forensic evidence.