9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Steve Simon <steve@quintile.net>
To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net>
Subject: Re: [9fans] memory bug in 5l
Date: Wed, 10 Dec 2014 01:35:38 +0000	[thread overview]
Message-ID: <55207B39-493A-4EDC-A246-2C838197D8F0@quintile.net> (raw)
In-Reply-To: <D0163309-3424-49C5-ABF6-33A58FFD2241@gmail.com>

the compilers use a very simple allocator which is designed for speed
rather than efficiency - as i remember it never frees anything and just
allocates from a heap.

it also works if you use libc's malloc and that will allow you to link big things
(like gs) on small memory machines. in reality memory is cheap and no one
likes to wait when they don't have to.

-Steve



> On 10 Dec 2014, at 00:24, yoann padioleau <aryx.padator@gmail.com> wrote:
> 
> Also, by curiosity, does anybody know why 5a/, 5l/, 5c/
> (and the other architecture variants) are redefining
> malloc and free? Why not using the malloc and free
> from the libc?
> 
> 
>> On Dec 9, 2014, at 4:21 PM, yoann padioleau <aryx.padator@gmail.com> wrote:
>> 
>> in 5l/obj.c#zaddr()
>> there is:
>>   case D_FCONST:
>>       while(nhunk < sizeof(Ieee))
>>           gethunk();
>>       a->ieee = (Ieee*)hunk;
>>       nhunk -= NSNAME;
>>       hunk += NSNAME;
>> 
>> I think it’s a copy paste bug, it should
>> be sizeof(Ieee) instead of those NSNAME
>> (or even better the whole code could be factorized
>> in a call to a->ieee = malloc(sizeof(Ieee));
> 



  reply	other threads:[~2014-12-10  1:35 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-10  0:21 yoann padioleau
2014-12-10  0:24 ` yoann padioleau
2014-12-10  1:35   ` Steve Simon [this message]
2014-12-10  1:19 ` yoann padioleau
2014-12-10 10:07   ` Charles Forsyth
2014-12-15 21:20     ` yoann padioleau

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=55207B39-493A-4EDC-A246-2C838197D8F0@quintile.net \
    --to=steve@quintile.net \
    --cc=9fans@9fans.net \
    /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).