This topic describes how to use C++ Memory Validator when you are developing programs with the Marmalade game SDK.
We assume that you have installed the Marmalade SDK and Marmalade Hub in the default location of c:\marmalade.
We assume that you are developing your game for many targets, but that for the purpose of testing with C++ Memory Validator you are also targeting x86 Debug and x86 Release configurations.
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.
To work with Marmalade it's best to go back to a known state then make a few changes to setup C++ Memory Validator for use with Marmalade.
1.Open the settings dialog, click Reset.
2.Go to the Collect settings
3.Disable all check boxes in the Memory section, except for Marmalade.
4.Disable all check boxes in the Handles section.
5.Click OK.
The reason for selecting these options is that it prevents C++ Memory Validator from monitoring the actions of the Marmalade simulator itself. If you're a developing a Marmalade game you only care about what your game does - the memory and handle allocation behaviour of the simulator are not your concern, thus you don't want to monitor them. That is why we've turned everything off except for the Marmalade check box.
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
c:/marmalade/8.0/s3e\win32\s3e_simulator_release.exe
If an example game (shipped with Marmalade) is found at this location
c:\Marmalade\8.0\examples\GameTutorial\Lua\Stage9\build_temp\build_stage9_vc14\Stage9_vc14_release.via
then the command line is
-via:"c:\Marmalade\8.0\examples\GameTutorial\Lua\Stage9\build_temp\build_stage9_vc14\Stage9_vc14_release.via"
and the startup directory is
c:\Marmalade\8.0\examples\GameTutorial\Lua\Stage9\build_temp\build_stage9_vc14\
This is how the launch dialog looks when you are launching this game.
We leave the Application to monitor unchanged. It should have the same value as Application to launch.