debug extension overhead

tom fogal tfogal@alumni.unh.edu
Wed May 20 19:52:00 GMT 2009


Benjamin Kosnik <bkoz@redhat.com> writes:
> 
> > Have you considered adding a knob that would turn on a subset of
> > _GLIBCXX_DEBUG checks that have lower overhead, e.g., guaranteed
> > constant factor?  Some users are giving up on it due to high overhead
> > in certain cases, but they could benefit from cheap checks, such as
> > vector subscript checks.  
> 
> Hmm. The idea was that for fine-grained checks, one would just select
> the debug extension on a per-header basis, instead of using
> _GLIBCXX_DEBUG. Ie, including debug/vector and
> using __gnu_debug::vector if all you want is vector subscript checks.

Does this work in practice?  I haven't tried, but:

  ... you can only link code compiled with debug mode and code compiled
  without debug mode if no instantiation of a container is passed
  between the two translation units. [1]

implies that doing so in a large application would be very difficult,
unless you didn't use containers as part of your interfaces.

-tom

[1] http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt12ch30s03.html#debug_mode.using.specific



More information about the Libstdc++ mailing list