|
Boost Users : |
Subject: Re: [Boost-users] boost::exception - leaking error_info
From: Emil Dotchevski (emildotchevski_at_[hidden])
Date: 2009-02-23 14:01:08
On Mon, Feb 23, 2009 at 9:31 AM, Bruce Laing
<bruce.laing_at_[hidden]> wrote:
> Emil,
>
> The platform is vc++ 8, boost 1.37.
>
> Since submitting my inquiry to the list, I cut my boost.exception code out
> into a separate test program that is very similar to the test code you gave
> in your reply (thanks for that) , but my test program does not leak, so the
> problem seems to involve some aspect of context from the original
> surrounding code that I'm not yet able to identify. I'll write back with an
> update if I can isolate the interaction that triggers the leakage.
Please do keep us posted, it's kind of important for exception objects
not to leak memory. :)
A couple of things to consider, assuming this isn't a compiler bug
(I'm sure these are unlikely but I'm running out of ideas):
- Do your exceptions cross DLL boundary by any chance? If a DLL links
to the static runtime, you might not be tracking the memory correctly
- Do you use multiple threads? It is *not* safe to access the same
exception object from multiple threads. If you use
boost::exception_ptr to transport exceptions between threads, keep in
mind that that only makes it OK to *refer* to the same exception
object from multiple threads, accessing the exception object itself
requires additional synchronization.
Emil Dotchevski
Reverge Studios, Inc.
http://www.revergestudios.com/reblog/index.php?n=ReCode
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net