Does a std::string always require heap memory?
<p>I have a simple question. I want to know whether <code>std::string</code> allocates memory every time in C++.</p>

<p>In my code, it seems that the constructor will use more memory to construct <code>tst_first_string</code> than for <code>tst_second_string</code>:</p>

<pre><code> char* first_string = new char[5];
 strcpy(first_string, "test");
 std::string tst_first_string(first_string);
 std::string tst_second_string("test");
</code></pre>