I have a class, and in its constructor I declare a std::string variable, buffer. It stores the contents of an input file, so this variable usually uses about 4MB.

I've noticed that when the program exits the constructor, the memory used by this variable is still used. This variable is not a pointer, so I don't understand why the memory is not getting recycled like your usual stack variable. What's going on and what should I do?