From 554fd8c5195424bdbcabf5de30fdc183aba391bd Mon Sep 17 00:00:00 2001 From: upstream source tree Date: Sun, 15 Mar 2015 20:14:05 -0400 Subject: obtained gcc-4.6.4.tar.bz2 from upstream website; verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository. --- libstdc++-v3/doc/html/manual/dynamic_memory.html | 72 ++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 libstdc++-v3/doc/html/manual/dynamic_memory.html (limited to 'libstdc++-v3/doc/html/manual/dynamic_memory.html') diff --git a/libstdc++-v3/doc/html/manual/dynamic_memory.html b/libstdc++-v3/doc/html/manual/dynamic_memory.html new file mode 100644 index 000000000..481347bef --- /dev/null +++ b/libstdc++-v3/doc/html/manual/dynamic_memory.html @@ -0,0 +1,72 @@ + + +Dynamic Memory

+ There are six flavors each of new and + delete, so make certain that you're using the right + ones. Here are quickie descriptions of new: +

+ They are distinguished by the parameters that you pass to them, like + any other overloaded function. The six flavors of delete + are distinguished the same way, but none of them are allowed to throw + an exception under any circumstances anyhow. (They match up for + completeness' sake.) +

+ Remember that it is perfectly okay to call delete on a + NULL pointer! Nothing happens, by definition. That is not the + same thing as deleting a pointer twice. +

+ By default, if one of the throwing news can't + allocate the memory requested, it tosses an instance of a + bad_alloc exception (or, technically, some class derived + from it). You can change this by writing your own function (called a + new-handler) and then registering it with set_new_handler(): +

+   typedef void (*PFV)(void);
+
+   static char*  safety;
+   static PFV    old_handler;
+
+   void my_new_handler ()
+   {
+       delete[] safety;
+       popup_window ("Dude, you are running low on heap memory.  You
+		      should, like, close some windows, or something.
+		      The next time you run out, we're gonna burn!");
+       set_new_handler (old_handler);
+       return;
+   }
+
+   int main ()
+   {
+       safety = new char[500000];
+       old_handler = set_new_handler (&my_new_handler);
+       ...
+   }
+   

+ bad_alloc is derived from the base exception + class defined in Sect1 19. +

-- cgit v1.2.3