Browse Source

[trac812] added some more notes about throw_size_on_new
(also made a minor editorial cleanup: removed a redundant space in .cc)

JINMEI Tatuya 14 years ago
parent
commit
78bd2b7778
2 changed files with 7 additions and 1 deletions
  1. 1 1
      src/lib/util/unittests/newhook.cc
  2. 6 0
      src/lib/util/unittests/newhook.h

+ 1 - 1
src/lib/util/unittests/newhook.cc

@@ -36,7 +36,7 @@ operator new(size_t size) throw(std::bad_alloc) {
 void
 operator delete(void* p) throw() {
     if (p != NULL) {
-        free (p);
+        free(p);
     }
 }
 #endif

+ 6 - 0
src/lib/util/unittests/newhook.h

@@ -61,6 +61,12 @@ extern bool force_throw_on_new;
 
 /// The allocation size that triggers an exception in the special operator new
 ///
+/// This is the exact size that causes an exception to be thrown;
+/// for example, if it is set to 100, an attempt of allocating 100 bytes
+/// will result in an exception, but allocation attempt for 101 bytes won't
+/// (unless, of course, memory is really exhausted and allocation really
+/// fails).
+///
 /// The default value is 0.  The value of this variable has no meaning
 /// unless the use of the special operator is enabled at build time and
 /// via \c force_throw_on_new.