#205·doctest

Memory leaks just by including doctest.h

Author: edmundvermeulenCreated Mar 21, 2019Updated Sep 1, 2026

Description

We upgraded from doctest 1.2.6 to 2.2.3. Now Visual Studio reports memory leaks.

Steps to reproduce

The following simple example code gives 3 memory leaks when run.

cpp
#include "stdafx.h"

#define DOCTEST_CONFIG_IMPLEMENT
#include "doctest.h"

int main()
{
    int flag = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG);
    _CrtSetDbgFlag(flag | _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);

    return 0;
}
Detected memory leaks!
Dumping objects ->
{175} normal block at 0x004F5620, 8 bytes long.
 Data: <  O     > EC 98 4F 00 00 00 00 00 
{163} normal block at 0x004F5578, 8 bytes long.
 Data: <| O     > 7C 8E 4F 00 00 00 00 00 
{156} normal block at 0x004F57E0, 8 bytes long.
 Data: < 5O     > AC 35 4F 00 00 00 00 00 
Object dump complete.

Extra information

  • doctest version: 2.2.3
  • Operating System: Windows 10
  • Compiler+version: Microsoft Visual Studio 2015