Marmalade game SDK support

By Stephen Kellett
16 December, 2015

We’ve recently added support for the Marmalade game SDK to Memory Validator.

This article will show you how to:

  1. Configure a Marmalade project for use with Memory Validator.
  2. How to set up Memory Validator for use with Marmalade.
  3. How to launch a Marmalade game from Memory Validator.

Configuring your project settings

To work with 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

Marmalade Visual Studio compiler settings

 

Editing the link stage debug information

Marmalade Visual Studio linker settings

 

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 Memory Validator cannot find the Marmalade memory allocators and will not be able to track the Marmalade memory allocations your game makes.
  • Without symbols Memory Validator will not be able to turn callstack addresses into class names, function names, filenames and line numbers.

Configuring 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 Memory Validator.

  1. Open the settings dialog. Click Reset. This will reset all Memory Validator settings to the default.
  2. 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.
  3. Click OK.

Memory Validator collect settings for Marmalade

 

Launching the game

To launch a Marmalade game with 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\

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.

Memory Validator launching a Marmalade game

 

  1. Click Go! to launch the Marmalade game.
  2. Memory Validator will monitor all memory allocations, reallocations and deallocations made via the s3eMalloc, s3eRealloc, s3eFree functions.
  3. Run your game as normal, then close your game.
  4. Wait for Memory Validator to show you any leaks on the Memory tab. Additional statistics can be viewed on the Objects, Sizes, Timeline and Hotspots tabs.

Fully functional, free for 30 days