AQTime boundary checks with Irrlicht template containers

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
Nyxojaele
Posts: 98
Joined: Mon Sep 18, 2006 4:06 am

AQTime boundary checks with Irrlicht template containers

Post by Nyxojaele »

I'm not 100% sure this is an issue with Irrlicht, but I'm relatively certain since the problem doesn't seem to crop up with STL templates, nor does it appear to happen with other Irrlicht objects.

I've tested this with irr::core::list, irr::core::map, irr::core::array, and irr::core::stringc and get the same issue. In contrast, I've also tested it with irr::u32 and there's no problems.

Here is my setup: Mixed mode C++/CLI project in Visual Studio 2008 and an AQTime profiling project set to the Allocation profiler, with the option "Check Memory Bounds" turned on.
Code to replicate the issue:

Code: Select all

#include <windows.h>
#include "irrlicht.h"

int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
	irr::core::list<int> *l = new irr::core::list<int>();
	delete l;

	return 0;
}
Issue that occurs: When I run the program thru the profiler, it reports a couple of "Memory Overwrite Errors". Removing the delete line will obviously result in AQTime reporting a leak, and removing both the new and delete lines will result in a clean run. Replacing the new line with the following:

Code: Select all

irr::u32 *l = new irr::u32();
also results in a clean run, which leads me to believe it's a template issue, but I'm not sure.

Is there some fancy allocation/deallocation process being used by Irrlicht that could be affecting AQTime's methods of detecting boundary overwriting?

A quick rundown of how AQTime does boundary checking (also available in more detail in their help file) is that it hooks calls to allocation functions and actually allocates 8 additional bytes, 4 at the beginning, and 4 at the end, which it fills with it's own signatures, but only reports back the original amount of bytes requested by the application to use. If the application writes past the beginning/end of the block of memory, AQTime notices because it's signature will be changed, so it reports back that something has written outside of it's boundaries.

Edit: I just tested this again with irr::video::SMaterial, and I have the same problem, so that blows the templates idea out of the water. Any ideas?
hybrid
Admin
Posts: 14144
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

All those structures use irrAllocator for memeory handling. Seems that your tool does not handle this properly.
Nyxojaele
Posts: 98
Joined: Mon Sep 18, 2006 4:06 am

Post by Nyxojaele »

I see. Thank you for the insight. I'll take a closer look at how irrAllocator works, and hopefully I can find something on my own.
Post Reply