Re: gdb help: debugging a segfault in boost::shared_ptr



phear wrote:
Putting a lock on IDatabaseAdapter.GetAdapter() did not help. Locking
Instance::GetEntry fixed it, but this ofcourse defies the purpose of
multi-threading.

I have tried using normal pointers instead, and although a lot more
rare, it still segfaults occasionally.

I am currently following a lead from valgrind, but I'm not going to
hold my breath just yet.

[...]

It's not a problem with shared_ptr or with the debugger. The "lock-free"
stuff in shared_ptr is a red herring. It's an implementation issue to make
it thread-safe and could just have easily been lock based and is lock
based on some platforms. Thread-safe means that shared_ptr handle
internally shared data safely, i.e. the reference count. It does not
mean it is atomically thread-safe like Java pointers and that you
don't need some form of external synchronization if the pointers are
shared.

If you want to see what an atomically thread-safe refcount pointer looks
like, take a look at atomic_ptr in
http://atomic-ptr-plus.sourceforge.net/

We can't give you too much specific advice on how to solve your
problem since we know few specifics on what you are trying
to accomplish.


--
Joe Seigh

When you get lemons, you make lemonade.
When you get hardware, you make software. .



Relevant Pages

  • Re: [PATCH 08 of 11] anon-vma-rwsem
    ... have the padding due to the alignment of the 64-bit pointers in the ... On 32-bit, the alignment of list-head is obviously just 32 bits, so right ... now the structure is "perfectly packed" and doesn't have any empty space. ... spinlock_t lock; ...
    (Linux-Kernel)
  • Re: file locking.
    ... On Thu, 16 Aug 2007, John Baldwin wrote: ... I just introduced an extra flag so I could remove the race from dropping the lock inbetween operations and get an accurate count of how big the array needs to be. ... What's more troubling is the continued erosion of support for libkvm as it ... Well shaving off two pointers gets us into cacheline size for struct file which has some perf improvement. ...
    (freebsd-arch)
  • Re: Smart Pointers and Microsoft Foundation Classes
    ... LockProxy operator++{ ... lock l; ... problems that come with raw pointers, such as the need to delete them at ... Ownership is always important. ...
    (microsoft.public.vc.mfc)
  • Re: Accessing process information from inside a LKM?
    ... > not aware of a kernel interface to lock the list and iterate across it. ... of the proc struct changes frequently. ... Does one navigate the process list using the five child/sibling pointers or by ... Jimmie Mayfield http://www.sackheads.org/mayfield email: mayfield+usenet@sackheads.org My mail provider does not welcome UCE -- http://www.sackheads.org/uce ...
    (comp.sys.hp.hpux)
  • Re: Most elegant way to read to allocatable array?
    ... The lock on the I/O unit table is unlocked as soon as ... file handles tend to be pointers. ... no deficiencies and the other way is to make it so complicated ...
    (comp.lang.fortran)