certik / yaml-cpp

Automatically exported from code.google.com/p/yaml-cpp
MIT License
0 stars 0 forks source link

unbounded memory usage when repeatedly calling Node::operator[const Key&] const #227

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

There is unbounded memory usage when repeatedly calling Node::operator[]& const 
with a key that does not exist.
This does not reproduce when calling the non const version.

Sample program:

#include <string>
#include "yaml-cpp/yaml.h"

int main()
{
    const YAML::Node node;

    std::string key = "doesnotexist";
    for (;; )
    {
        node[key];
    }
}

What is the expected output? What do you see instead?
Expected: the memory usage of this program stays consistent.
Actual: the memory usage of this program increases until the program crashes 
due to an out of memory error.

What version of the product are you using? On what operating system?
yaml-cpp-0.5.1

Please provide any additional information below.

Original issue reported on code.google.com by mark.gu...@gmail.com on 26 Nov 2013 at 10:01

GoogleCodeExporter commented 9 years ago
Interesting! I'll look into it.

Original comment by jbe...@gmail.com on 26 Nov 2013 at 10:06

GoogleCodeExporter commented 9 years ago
Fixed, r730c40a3fca54f5a829d1dd20f000e284099e1d8.

It was simply creating a new Node every call to operator[] const.

Original comment by jbe...@gmail.com on 24 Jan 2015 at 11:25