Click to See Complete Forum and Search --> : debug vs release: "Object reference not set to an instance of an object"


barbiomalefico
July 22nd, 2003, 03:23 AM
I have create a software formed by a list of dlls which are made in native, managed and mixed code.
I test my software in debug and all is working good.
When i build the same software in release i have no build e no link error and the software starts.
During the runtime appears a System Null Refernce object Error: "Object reference not set to an instance of an object" .
I have the default optimization in realease (maximize speed) and i try to disable all optimization, but the bug remain.

Some Ideas?


Ciao

alexp2000
March 30th, 2005, 05:35 PM
I am having a very similar problem. My code works perfectly in the Debug compile configuration, but fails in the Release configuration, but only when run standalone (not when run within Visual Studio).
Did you manage to get anywhere with your problem?
It appears to be some memory allocation problem with the line:

double **dblX;
dblX = new double*[intDim1];

in my code. Should be fine. intDim1 = 10. I get a similar error with:

double **dblX = (double**)calloc(intDim1,sizeof(double*));

which is obviously the old version of the line above!
Any ideas anyone?

Alex

mrcomplex
July 6th, 2005, 09:47 AM
How do you disable all optimization in the release mode? I tried to do that but the fields for optimization are all grayed out!!! there must be another flag somewhere to un-gray out the optimization field? can anybody help? thanks in advance.