public inbox for gsl-discuss@sourceware.org
 help / color / mirror / Atom feed
From: Gerard Jungman <jungman@lanl.gov>
To: "Field G. Van Zee" <field@cs.utexas.edu>
Cc: gsl-discuss mailing list <gsl-discuss@sourceware.org>
Subject: Re: Feedback from GSL folks on libflame 4.0
Date: Wed, 24 Feb 2010 01:42:00 -0000	[thread overview]
Message-ID: <1266975834.27033.163.camel@manticore.lanl.gov> (raw)
In-Reply-To: <4B7F656C.5040406@cs.utexas.edu>

On Fri, 2010-02-19 at 22:30 -0600, Field G. Van Zee wrote:
> 
> In very early versions of libflame (before it was even called "libflame") there
> was only one object struct which contained all fields. Later, Robert separated
> the "view" data from the base object data. It seemed like the smart thing to do
> at the time, but I can see how it might incur quite a bit more memory overhead.
> I can see arguments going both ways on whether we need to worry about that extra
> memory cost.

Memory overhead is not the issue. The problem is that any use of
the C heap (malloc()/free() and friends) ties the implementation
to that one allocation strategy. This makes it hard (impossible ?)
for other environments to control the allocation strategies.
Compare to the C++ STL containers, where the allocation strategy
is parametrized (literally a template parameter), by design.

Separating the views and the base objects is a good idea, since
the views are (at least in principle) light-weight objects. But
tying the composition of these objects to a heap allocation is
restrictive.

The way I think of this is that the 'view' is like the base class
in the hierarchy. What you call the 'base object' is actually
the derived object, since both views and bases must export the
interface for access, but the object with the data extends
this functionality by actually managing the data segment.

Sorry if I'm stating obvious stuff. I'm sure you have thought
about these things. But I wanted to explain how I look at it.
I don't know if there is an easy answer for this type of
container design in C, but its good to know the trade-offs.

--
G. Jungman


  parent reply	other threads:[~2010-02-24  1:42 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <4a00655d1002171047t4e87fb85w88b609245e3f9a8e@mail.gmail.com>
2010-02-19  8:48 ` Field G. Van Zee
2010-02-18 19:51   ` Rhys Ulerich
2010-02-19  0:20     ` Gerard Jungman
2010-02-19 20:22     ` Brian Gough
2010-02-19  0:00   ` Gerard Jungman
2010-02-20  4:30     ` Field G. Van Zee
2010-02-23 13:13       ` Brian Gough
2010-02-24  1:42       ` Gerard Jungman [this message]
2010-02-19 18:19   ` Brian Gough
2010-02-19 18:41     ` Robert G. Brown
2010-02-19 20:57       ` Gerard Jungman
2010-02-19 21:46         ` Robert G. Brown
2010-02-19 22:34           ` Gerard Jungman
2010-02-22 23:09         ` Brian Gough
2010-02-23 10:50           ` Theodore Papadopoulo
2010-02-23 14:55             ` Robert G. Brown
2010-02-24  1:50               ` Gerard Jungman
2010-02-24 11:31                 ` Robert G. Brown
2010-02-23 17:39           ` James Amundson
2010-02-19 20:07   ` Brian Gough
2010-02-19 20:54     ` Gerard Jungman
2010-02-20  4:31     ` Field G. Van Zee

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1266975834.27033.163.camel@manticore.lanl.gov \
    --to=jungman@lanl.gov \
    --cc=field@cs.utexas.edu \
    --cc=gsl-discuss@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).