9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Rob Pike <robpike@gmail.com>
To: Fans of the OS Plan 9 from Bell Labs <9fans@cse.psu.edu>
Subject: Re: [9fans] stringwidth leak or ignorance?
Date: Sat, 28 May 2005 01:18:12 -0700	[thread overview]
Message-ID: <7359f04905052801183a4ddd13@mail.gmail.com> (raw)
In-Reply-To: <14103261a9b76e26bd8bff97afbaa1ef@lsub.org>

the call to _getsubfont just puts the subfont into the subfont
cache so the character can be looked up there the next time
around the loop.  there should be no leak.  freeing the subfont
will break the cache.

-rob

On 5/26/05, Fco. J. Ballesteros <nemo@lsub.org> wrote:
> 
> Hi,
> 
>         I've seen that  at point
> sys/src/libdraw/stringwidth.c:46
>   45            if(subfontname){
> >46                     if(_getsubfont(f->display, subfontname) == 0){
>  47                             def = f->display->defaultfont;
>  48                             if(def && f!=def)
>  49                                     f = def;
>  50                             else
>  51                                     break;
> 
> there seems to be a leak.
> _getsubfont returns a Subfont, which is not freed. However, there
> seems to be some side effect, because if I free the subfont, the routine breaks.
> 
> This came from using leak on a program using stringwidth a lot. The program
> shows leaks that come from this point. So I tried to fix it. I still don't know enough
> of font handling to propose a course of action. Any suggestion?
> 
> If I come up with a fix, I'll send a patch anyway.
> 
> thanks
> 
>


      reply	other threads:[~2005-05-28  8:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-26 10:32 Fco. J. Ballesteros
2005-05-28  8:18 ` Rob Pike [this message]

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=7359f04905052801183a4ddd13@mail.gmail.com \
    --to=robpike@gmail.com \
    --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).