9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: andrey mirtchovski <mirtchov@cpsc.ucalgary.ca>
To: 9fans@cse.psu.edu
Subject: Re: [9fans] making emalloc a library function
Date: Sun,  7 Mar 2004 09:47:01 -0700	[thread overview]
Message-ID: <345297dba3bd4c579598a90b9a7e9a06@plan9.ucalgary.ca> (raw)
In-Reply-To: <20040307172511.GA31935@melkki.cs.Helsinki.FI>


> Well it seems that many programs in the source tree want the same
> behaviour as it is. And no-one would be forced to use the library.

Isn't that the reverse of 'whoever wants it, could write it in their
own code'?  Less than 50% of all Plan 9 programs use emalloc so there
isn't a majority rule you can apply.

> 
> The functions lib9p seem to do this (at least close). Would it 
> be possible to start from there? 
> 

The exceptions that prove the rule?  See how they aren't called
'emalloc' :)

Have you considered at the problem from all sides?  What are your
suggested implementations for eallocimage() and egetwindow()?

> So why are part of the emalloc implementations missing e.g.
> setmalloctag? Of course it is quite trivial to write, but in my
> opinion having dozens of definitions for the same function is
> not exactly sane. 

TPOP was the first to mention emalloc (not that it wasn't used
before), its authors were wise not to suggest default behavior.

> Also if one writes a malloc wrapper which 
> behaves unlike the emallocs naming it emalloc is quite confusing.

Again, you assume emalloc has a well defined behaviour.  It doesn't.
The fact that everybody uses it the same way means that they haven't
really thought out how their programs should behave after malloc has
returned an error.  Would you be happy if fossil called the library
emalloc and sysfatal()-ed after some user process has allocated too
much memory "just for fun"?  What should fossil do, define
eemalloc()?

andrey



  reply	other threads:[~2004-03-07 16:47 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-07 11:32 Einar Karttunen
2004-03-07 12:56 ` David Presotto
2004-03-07 15:37 ` andrey mirtchovski
2004-03-07 17:06   ` Rob Pike
2004-03-07 17:25     ` Einar Karttunen
2004-03-07 16:47       ` andrey mirtchovski [this message]
2004-03-07 23:05         ` Geoff Collyer
2004-03-07 23:10           ` boyd, rounin
2004-03-08 10:26             ` Douglas A. Gwyn
2004-03-07 18:45       ` 9nut
2004-03-07 18:48     ` 9nut
2004-03-07 19:39     ` boyd, rounin
2004-03-07 19:34   ` boyd, rounin
2004-03-08 10:25 ` Douglas A. Gwyn

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=345297dba3bd4c579598a90b9a7e9a06@plan9.ucalgary.ca \
    --to=mirtchov@cpsc.ucalgary.ca \
    --cc=9fans@cse.psu.edu \
    /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 NNTP newsgroup(s).