Memory Allocations/Deallocations problems
-
I'm using a library in my MFC application and i'm having some memory problems with allocations and deallocations, some memory allocations/deallocations causes a crash but only if it is not running on debug-mode. In debug-mode the application runs perfectly. Here's my lib configurations: engine.lib ( Non-MFC Code ): . Configuration Properties: ----. General: ------. Configuration Type: Static Library ( .lib ) ------. Use of MFC: Use Standard Windows Libraries ----. C++: ------. Code Generation: ---------. Runtime Library: Multi-Threaded Debug ( /MTd ) editor ( MFC Code ): . Configuration Properties: ----. General: ------. Configuration Type: Application ( .exe ) ------. Use of MFC: Use MFC in a Static Library ----. C++: ------. Code Generation: ---------. Runtime Library: Multi-Threaded Debug ( /MTd ) ------. Precompiled Header: ---------. Create/Use Precompiled Header: Automatically Generate( /YX ) ----. Linker: ------. Command Line: /NODEFAULTLIB:LIBCD.LIB Noticed anything wrong ? Any tip ? Thanks
-
I'm using a library in my MFC application and i'm having some memory problems with allocations and deallocations, some memory allocations/deallocations causes a crash but only if it is not running on debug-mode. In debug-mode the application runs perfectly. Here's my lib configurations: engine.lib ( Non-MFC Code ): . Configuration Properties: ----. General: ------. Configuration Type: Static Library ( .lib ) ------. Use of MFC: Use Standard Windows Libraries ----. C++: ------. Code Generation: ---------. Runtime Library: Multi-Threaded Debug ( /MTd ) editor ( MFC Code ): . Configuration Properties: ----. General: ------. Configuration Type: Application ( .exe ) ------. Use of MFC: Use MFC in a Static Library ----. C++: ------. Code Generation: ---------. Runtime Library: Multi-Threaded Debug ( /MTd ) ------. Precompiled Header: ---------. Create/Use Precompiled Header: Automatically Generate( /YX ) ----. Linker: ------. Command Line: /NODEFAULTLIB:LIBCD.LIB Noticed anything wrong ? Any tip ? Thanks
It is nothing to do with your configuration. It very likely cause by your code. The reason it won't crash in debug mode is that your linker allocates more storage space for each memory blocks in your program for debug purposes. So, even if your program leaks, the extra space storage save you from crash. This is not going to happen when you are in release mode as when your linker allocate exact storage space for your program. Sonork 100.41263:Anthony_Yio