Boost logo

Boost Users :

Subject: [Boost-users] regex memory leaks
From: jamich - Post (jamich_at_[hidden])
Date: 2011-11-08 00:46:03


I have problem with memory leaks. I use boost version 1.47. I compiled boost libray by Visual Studio 2010 SP1. My testing code is here:

#include "stdafx.h"
#include <stdio.h>
#include <boost/regex.hpp>

void Memtest()
{
    boost::regex e("^(\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3})(:\\d{1,5})?$");

    if ( boost::regex_match("1.a.1.1", e) )
        std::cout << "ok" << std::endl;

    if ( boost::regex_match("1.1.1.1", e) )
        std::cout << "ok" << std::endl;
}

int main(int argc, _TCHAR* argv[])
{
    _CrtSetReportMode( _CRT_ERROR, _CRTDBG_MODE_DEBUG );

    _CrtMemState state;
    _CrtMemCheckpoint(&state);

    Memtest();

    _CrtMemState newState, diff;
    _CrtMemCheckpoint(&newState);
    if(_CrtMemDifference(&diff, &state, &newState))
    {
        _CrtMemDumpStatistics(&diff);
    }

        return 0;
}

This code comes from simple console based project. Debugger gives me these output:

0 bytes in 0 Free Blocks.
5544 bytes in 16 Normal Blocks.
0 bytes in 0 CRT Blocks.
0 bytes in 0 Ignore Blocks.
0 bytes in 0 Client Blocks.
Largest number used: 9333 bytes.
Total allocations: 13620 bytes.

Could anyone help me to resolve these memory leaks?

Thanks,
 Michal


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net