[PATCH] Slightly better way to __USE_MALLOC

Brad Spencer spencer@infointeractive.com
Wed Oct 9 10:09:00 GMT 2002


On Wed, Oct 09, 2002 at 01:49:11AM -0500, Benjamin Kosnik wrote:
> 
> This is a very interesting patch. I'll let Phil and Loren comment, but I
> think this is a good idea. Thanks for sharing it.

You're most welcome.  I'd like to share more.  If I knew
off-hand how to do more with configure, I'd probably have gone
further.  Perhaps I'll find the time to learn and followthrough. :)

> You might want to document the --enable flag in configopts.html. Notice
> that most of the ABI breaking configure flags are explicitly marked.
> This option should be as well.

I'm attaching a patch with this documentation.  Am I being too
verbose?  This patch is against the latest CVS revision of the docs.

> > rebuilt the library (and found my bug quite quickly with "mpatrol",
> > BTW), 
> 
> mpatrol?

I actually stumbled upon it by near accident.  It's a LGPL'ed
near-equivalent to Purify (at least with respect to heap
allocations).  I personally like it better so far.  Here's a link.

http://www.cbmamiga.demon.co.uk/mpatrol/

Click on the not-entirely-obvious "Online Documentation" image near
the bottom of the page to see the very extensive manual.

> At some point, something like this should be done in a more general way
> so that an un-optimized, debug version of libstdc++ could be built and
> lurk for later use. It seems to be generally useful, both for debugging
> and use with other tools like valgrind, etc.

That sounds very useful.  I plan to generate the debug version by
hand for now.  Maybe doing that a few times will reveal how it can be
automated :)

> Looks pretty good to me.

Thanks!  Glad to be able to contribute even a little.

-- 
------------------------------------------------------------------
Brad Spencer - spencer@infointeractive.com - "It's quite nice..."
Systems Architect | InfoInterActive Corp. | A Canadian AOL Company
-------------- next part --------------
2002-10-09    <spencer@localhost.localdomain>

	* docs/html/configopts.html: Documented new --enable-use-malloc


Index: docs/html/configopts.html
===================================================================
RCS file: /cvsroot/gcc/gcc/libstdc++-v3/docs/html/configopts.html,v
retrieving revision 1.25
diff -u -p -r1.25 configopts.html
--- docs/html/configopts.html	9 Sep 2002 20:26:42 -0000	1.25
+++ docs/html/configopts.html	9 Oct 2002 17:07:50 -0000
@@ -232,6 +232,20 @@ options</a></h1>
      </p>
  </dd>
 
+ <dt><code>--enable-use-malloc</code></dt>
+ <dd><p>Build the library using a <code>malloc</code>-based memory allocator
+        for STL and other components.  The default is 'no', which
+        selects the faster pool-based allocator.  Enabling this feature
+        allows for better integration with memory debugging and profiling
+        tools at the cost of performance.  This option can change the library
+        ABI because it will build the library with
+        <code>-D_GLIBCPP_USE_MALLOC=1</code>.
+        Only code that is also built (entirely) with this macro defined can be
+        linked against a '<code>--enable-use-malloc</code>' library, and only 
+        code without it defined can be linked against a normally-built library.
+     </p>
+ </dd>
+
  <dt><code>--enable-symvers[=style]  </code></dt>
  <dd><p>In 3.1, tries to turn on symbol versioning in the shared library (if a
         shared library has been requested).  The only 'style' currently


More information about the Libstdc++ mailing list