3

I am receiving this error message when using cppunit to test my application

Allocation/deallocation type mismatch
allocated at file: <unknown> line: 0 size: 262144 type: new []
deallocated at file: <unknown> line: 0 type: delete

I have already solved this particular problem, my question is how do I enable better information instead of unknown file and line 0?

gunr2171
  • 16,104
  • 25
  • 61
  • 88
Justin Wood
  • 9,941
  • 2
  • 33
  • 46

1 Answers1

1

You need to include "MemoryLeakDetectorFreeMacros.h" and/or "MemoryLeakDetectorMallocMacros.h" in every sourcefile in your code under test, and also define CPPUTEST_USE_MEM_LEAK_DETECTION.

Most compilers have a flag you can use to automatically include a header in every source file; gcc has -include and MSVC has /FI.

Gutskalk
  • 117
  • 1
  • 3