We’ve recently added support for the Marmalade game SDK to C++ Memory Validator.
This article will show you how to configure a Marmalade project for use with C++ Memory Validator, how to setup C++ Memory Validator for use with Marmalade and how to launch a Marmalade game from C++ Memory Validator.
Configuring your project settings
To work with C++ Memory Validator you need to build the x86 Debug configuration and/or the x86 Release configuration of your Marmalade project using Visual Studio.
These configurations need to be built so that they create debug information and so that a PDB file containing debug information is created. The example projects that ship with Marmalade do not do this – you will need to edit them to make the linker stage create debug information.
Editing the compile stage debug information
Editing the link stage debug information
You must ensure that both compile and link stages have the correct settings set. If only compile or only link is set you will not get debugging symbols.
Debugging symbols are important for two reasons:
- Without symbols C++ Memory Validator cannot find the Marmalade memory allocators and will not be able to track the Marmalade memory allocations your game makes.
- Without symbols C++ Memory Validator will not be able to turn callstack addresses into class names, function names, filenames and line numbers.
Configuring C++ Memory Validator
In order to work correctly with Marmalade we need to make sure we’re only going to track the memory allocation your game makes with Marmalade and not any of the work that the Marmalade game engine is doing itself. We need to make a few simple changes to C++ Memory Validator.
- Open the settings dialog. Click Reset. This will reset all C++ Memory Validator settings to the default.
- Go to the Collect tab, disable the check boxes in the top two groups of check boxes, then enable the single Marmalade check box. The settings should look like shown below.
- Click OK.
Launching the game
To launch a Marmalade game with C++ Memory Validator we launch the Marmalade simulator and specify the game to run using the Marmalade -via command line argument.
If Marmalade is installed in c:\marmalade then the path to the simulator is
If an example game (shipped with Marmalade) is found at this location
then the command line is
and the startup directory is
We leave the Application to monitor unchanged. It should have the same value as Application to launch.
This is how the launch dialog looks when you are launching this game.
Click Go! to launch the Marmalade game. C++ Memory Validator will monitor all memory allocations, reallocations and deallocations made via the s3eMalloc, s3eRealloc, s3eFree functions. Run your game as normal, then close your game. Wait for C++ Memory Validator to show you any leaks on the Memory tab. Additional statistics can be views on the Objects, Sizes, Timeline and Hotspots tabs.