I have the same problem as reported by Visual Studio memory leak detection not printing file name and line number and several others. I am not getting the line number and file name in the output. Thus the title. I get all the other information; for example:
Dumping objects ->
{79} normal block at 0x000002193D173F30, 56 bytes long.
Data: <0? = 0? = > 30 3F 17 3D 19 02 00 00 30 3F 17 3D 19 02 00 00
Object dump complete.
HOWEVER I am using _DEBUG; it is in the project's preprocesser properties.
I have
#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>
at the beginning of the code
I call
_CrtDumpMemoryLeaks();
at program termination
and most of all, I am using C with calloc and free and not C++ 'new'. Most of the problems were with respect to not including the special macro to handle the fact they were using 'new'. I got so desperate I defined the macro anyways and of course it made no difference. The program is quite simple:
#define _CRTDBG_MAP_ALLOC
#include <stdio.h>
#include <stdlib.h>
#include <crtdbg.h>
#include "UnitTestMethods.h"
int main()
{
//_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
printf(getMderFloatFromStringTests() ? "==> PASS: " : "==> !! FAIL: ");
printf("Overall result of MderFloat from String tests\n");
printf(getBtleTimeFromDtmTests() ? "==> PASS: " : "==> !! FAIL: ");
printf("Overall result for DTM to BTLE time stamp tests\n");
printf(loadStringFromJsonTests() ? "==> PASS: " : "==> !! FAIL: ");
printf("Overall result of Load String from JSON tests\n");
printf(hexStringToBytesLittleEndianTest() ? "==> PASS: " : "==> !! FAIL: ");
printf("Overall result for HEX string to byte array little endian tests\n");
printf(bytesToHexTest() ? "==> PASS: " : "==> !! FAIL: ");
printf("Overall result for byte array to HEX tests\n");
printf(encodeCommonControlsBatteryTests() ? "==> PASS: " : "==> !! FAIL: ");
printf("Overall result for encode common controls battery tests\n");
printf(encodeCommonControlsDisTests() ? "==> PASS: " : "==> !! FAIL: ");
printf("Overall result for encode common controls DIS tests\n");
printf(encodeCommonControlsDateTimeTests() ? "==> PASS: " : "==> !! FAIL: ");
printf("Overall result for encode common controls DateTime tests\n");
printf(encodeCommonControlsDateTimeEmptyTests() ? "==> PASS: " : "==> !! FAIL: ");
printf("Overall result for encode common controls DateTime Empty tests\n");
printf(encodeCommonControlsCtsTests() ? "==> PASS: " : "==> !! FAIL: ");
printf("Overall result for encode common controls CTS tests\n");
printf(encodeCommonControlsCtsEmptyTests() ? "==> PASS: " : "==> !! FAIL: ");
printf("Overall result for encode common controls CTS empty tests\n");
printf(encodeThermParamsTests() ? "==> PASS: " : "==> !! FAIL: ");
printf("Overall result for encode ThermParam tests\n");
_CrtDumpMemoryLeaks();
}
Is there anything else I could be missing? I found all my other memory leaks except the one above by carefully parsing the code, but it would have been much easier IF the name and line number had been printed for those!