Problem with deleting TArray

i have a problem with root, probably it is total stupid, but I hope somebody can help me here.
I am writing a simple data acquisition software in Visual Studio 2010 using the root framework.
For the acquired data I use TArrays, everything works nice until i try to close the program. When i delete the first TArray, the software crashes with a error: Access violation reading location 0x30b812b4.
Okay looks like a pointer went wrong.
Very strange is that exactly the same error happens for this minimal code:

#include "TArrayI.h"
#include "Riostream.h"

int main()
	TArrayI* test= new TArrayI(100);
	delete test; //<< error happens here 
	return 0;

Does anybody know where the error could be?
And I tried the same code with the histogram class; than it works.


This is due to a mix of debug/release runtime libraries. Your application MUST use the same runtime libraries than ROOT itself. So try to change the linker flag to match the debug (/MDd) or release (/MD) version of the runtime libraries.

Cheers, Bertrand.

Thanks a lot. It works using the /MD option.