Possible heap corruption (CameraSDK 1.1.3Final, VS2008)
Posted: Thu Jan 10, 2013 6:38 pm
Hi.
I've been trying to include the CameraSDK into my project,
but got strange bugs where I could not allocate any memory anymore.
Tracking them down, I reached this point:
Please don't comment on style or proper use of malloc or CameraManager. This is just an example to show that after calling X() or its member functions, malloc will only return null pointers.
That means trying to access the cameraSDK either severely corrupts the heap or does some other kind of magic to break malloc.
I'm using windows7 (64bit), and the project is a VS2008 32bit application.
I compile it with /MT (ie: static runtime library)(because I read on the forums that CameraLibrary is compiled with /MT), and do not get any library-incompatibility warnings.
(I have tried using /MD earlier, but that didn't work either).
I have currently only used CameraSDK 1.1.3Final.
What could be the source of this?
I've been trying to include the CameraSDK into my project,
but got strange bugs where I could not allocate any memory anymore.
Tracking them down, I reached this point:
Code: Select all
int main(int argc, char *argv[])
{
printf("-> malloc 1 :: %X \n",malloc(1)); // <-- this will return a valid memory address
CameraManager::X();
printf("-> malloc 2 :: %X \n",malloc(1)); // <-- THIS RETURNS NULL
exit(0);
}
That means trying to access the cameraSDK either severely corrupts the heap or does some other kind of magic to break malloc.
I'm using windows7 (64bit), and the project is a VS2008 32bit application.
I compile it with /MT (ie: static runtime library)(because I read on the forums that CameraLibrary is compiled with /MT), and do not get any library-incompatibility warnings.
(I have tried using /MD earlier, but that didn't work either).
I have currently only used CameraSDK 1.1.3Final.
What could be the source of this?