[Halld-offline] [Halld-online] Boost shared_ptr for Hall D Online
Elliott Wolin
wolin at jlab.org
Mon Dec 21 10:56:57 EST 2009
Hi,
Graham raises a good point concerning the lifetime and availability
outside of Linux of the Boost shared pointer.
If the usage in the online is kept simple then there are alternative
implementations of the shared pointer that could be substituted if the
Boost version goes away, ones where we have the source code. This
raises the question of why use a restricted subset of features of the
Boost version when we have code for a simplified version...why not just
use the simplified version?
We can discuss this at a future Online meeting.
Thanks,
Sincerely,
Elliott
================================================================================
Those raised in a morally relative or neutral environment will hold
no truths to be self-evident.
Elliott Wolin
Staff Physicist, Jefferson Lab
12000 Jefferson Ave
Suite 8 MS 12A1
Newport News, VA 23606
757-269-7365
================================================================================
Graham Heyes wrote:
> This is nice in principle but can you guarantee that you will run Linux, and in particular that the Boost shared pointer will be there, for the lifetime of GLUEX and hall-D? We are still five years or so from taking data in large volumes and I would hope that hall-D will be around for a few years after that. I know that CODA uses some third party libraries etc but Boost is a Linux only deal right now.
>
> My 10c worth,
> Graham
>
> On Dec 21, 2009, at 10:20 AM, Elliott Wolin wrote:
>
>
>> Hi,
>>
>> The Boost shared pointer (a type of smart pointer) appears now to be
>> standard on linux (I found it on my 32-bit and on my 64-bit RHEL
>> machines). I think we should seriously consider using it for the Hall D
>> online. See:
>>
>> http://www.boost.org/doc/libs/1_41_0/libs/smart_ptr/shared_ptr.htm
>>
>> for details.
>>
>> My proposal would be to outlaw "bare" pointers for all but the most
>> trivial tasks (and for backwards-compatibility in some cases), and use
>> the shared_ptr extensively. At some point I or someone else will give a
>> report on this at the Online meeting. This is not an urgent decision,
>> of course.
>>
>> Briefly, the shared_ptr class wraps a standard pointer in such a way as
>> to eliminate memory leaks. It keeps a reference count of the number of
>> places the wrapped ptr is being used, and guarantees that delete() is
>> called when it is not being used any more (very similar to what is done
>> in Java).
>>
>> The Online is fortunate that no real code has been developed yet and we
>> can adopt the shared_ptr before we start. I think it would be a great
>> idea for the offline to use it as well, but they 1) must support other
>> architectures where it may not be standard yet, and 2) already have a
>> large base of code.
>>
>> Thanks,
>>
>> --
>>
>> Sincerely,
>> Elliott
>>
>>
>> ================================================================================
>>
>>
>> Those raised in a morally relative or neutral environment will hold
>> no truths to be self-evident.
>>
>>
>> Elliott Wolin
>> Staff Physicist, Jefferson Lab
>> 12000 Jefferson Ave
>> Suite 8 MS 12A1
>> Newport News, VA 23606
>> 757-269-7365
>>
>> ================================================================================
>>
>> _______________________________________________
>> Halld-online mailing list
>> Halld-online at jlab.org
>> https://mailman.jlab.org/mailman/listinfo/halld-online
>>
>
>
>
More information about the Halld-offline
mailing list