[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Thread-safety issues in QtHandles
From: |
John W. Eaton |
Subject: |
Re: Thread-safety issues in QtHandles |
Date: |
Fri, 4 Nov 2011 15:51:37 -0400 |
On 4-Nov-2011, Michael Goffioul wrote:
| On Thu, Nov 3, 2011 at 4:37 PM, Michael Goffioul
| <address@hidden> wrote:
| > On Thu, Nov 3, 2011 at 8:55 AM, Michael Goffioul
| > <address@hidden> wrote:
| >>> Also, do these changes help with the problems you were seeing earlier
| >>> with the Qt code?
| >>
| >> I don't know yet. I wanted to pass the full test suite first.
| >
| > The first tests still show crashes, though in a more systematic (less
| > random) way. Crashes occur in shared_ptr cleanup code in
| > octave__user_function::bind_automatic_vars(), so I suspect again
| > multiple delete calls. I think I'll have to dig into the parsing code
| > and try to use shared_ptr objects when possible to see whether things
| > improve.
|
| As a follow-up, I've converted the parser to use shared_ptr instead,
| and this actually fixed the problem when running the test in bicg.m.
| But I still experienced crashes, so I continued digging and converted
| dim_vector class, which I had forgotten. However this still didn't
| solve the issue, so I ran octave within valgrind/drd and
| discovered/realized that the octave_allocator class is not
| thread-safe... [1]
|
| The question is: how to make the octave_allocator thread-safe? For
| instance I could use a mutex within the octave_allocator class, but
| will that degrade performances significantly? Does it make sense then
| to keep the specific allocator?
I wrote the octave_allocator class early on in Octave's history
thinking that it would help performance and memory usage some to not
call new directly for many small allocations. I don't really know
whether it is helpful or just excess baggage. Probably the easiest
way to experiment is to make a small change like the following to
disable it:
diff --git a/liboctave/oct-alloc.h b/liboctave/oct-alloc.h
--- a/liboctave/oct-alloc.h
+++ b/liboctave/oct-alloc.h
@@ -62,6 +62,7 @@
bool grow (void);
};
+#if 0
#if defined (HAVE_PLACEMENT_DELETE)
#define DECLARE_OCTAVE_ALLOCATOR_PLACEMENT_DELETE \
void operator delete (void *p, void *) \
@@ -87,5 +88,10 @@
#define DEFINE_OCTAVE_ALLOCATOR2(t, s) \
octave_allocator t::allocator (sizeof (t), s)
+#else
+#define DECLARE_OCTAVE_ALLOCATOR
+#define DEFINE_OCTAVE_ALLOCATOR(t)
+#define DEFINE_OCTAVE_ALLOCATOR2(t, s)
+#endif
#endif
jwe
- Re: Thread-safety issues in QtHandles, Michael Goffioul, 2011/11/02
- Re: Thread-safety issues in QtHandles, John W. Eaton, 2011/11/02
- Re: Thread-safety issues in QtHandles, Michael Goffioul, 2011/11/03
- Re: Thread-safety issues in QtHandles, Michael Goffioul, 2011/11/03
- Re: Thread-safety issues in QtHandles, Michael Goffioul, 2011/11/04
- Re: Thread-safety issues in QtHandles,
John W. Eaton <=
- Re: Thread-safety issues in QtHandles, Michael Goffioul, 2011/11/04
- Re: Thread-safety issues in QtHandles, John W. Eaton, 2011/11/04
- Re: Thread-safety issues in QtHandles, Michael Goffioul, 2011/11/05
- Re: Thread-safety issues in QtHandles, John W. Eaton, 2011/11/07
- Re: Thread-safety issues in QtHandles, Michael Goffioul, 2011/11/07
- Re: Thread-safety issues in QtHandles, John W. Eaton, 2011/11/07
- Re: Thread-safety issues in QtHandles, Michael Goffioul, 2011/11/07
- Re: Thread-safety issues in QtHandles, John W. Eaton, 2011/11/07
- Re: Thread-safety issues in QtHandles, Michael Goffioul, 2011/11/07
- Re: Thread-safety issues in QtHandles, Michael Goffioul, 2011/11/08