ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Yue Wang <yuleopen@gmail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: Possible memory leak?
Date: Mon, 2 Feb 2009 04:35:32 +0000	[thread overview]
Message-ID: <68bfdc900902012035s3aee016eo34b70f94d75b112c@mail.gmail.com> (raw)
In-Reply-To: <4985B9CB.6010409@wxs.nl>

> ok, thanks for noticing, i added a
>
>  fontforge.close(pfbblob)
>

good

>> btw, when MKIV is running for the first time (i.e., no cache file). it
>> will use a lot of memory (parsing a 10M font will use 700-800 MB
>
> hm so much?
>

Yes, when finish reading the following tex file without \bye using plain TeX,
LuaTeX will cost 719M memory on my machine. The font used is Adobe
song std light.

[yue@localhost ~]$ cat a.tex
\directlua0{
function load_font (filename)
local metrics = nil
   local font = fontforge.open(filename)
   if font then
       metrics = fontforge.to_table(font)
       fontforge.close(font)
   end
   return metrics
end
myfont = load_font('song.otf')
}
[yue@localhost ~]$

when using the above script loading four fonts (you can try this by
adding 3 myfont = load_font('song.otf')),
the memory consumption will be higher than 1G on my machine. Remember
I am using Plain TeX to do this test, MKIV will consume more memory.


> also, mem consumption reported is a bit of a lie because lua seems to
> allocates double of what it needed with each increment but not always use it
>
> otf fonts are already quite packed in mkiv (i'm considering adding an option
> to mtx-font to precache fonts but i'm not sure if it's worth the trouble
>
> is mem consumption less a second run?

Yes, dramatically less. with 4 chinese fonts loaded (I use zhfonts.tex
for testing), MKIV consumes 300-400MB.

Yue Wang
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


  reply	other threads:[~2009-02-02  4:35 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-01 14:44 Yue Wang
2009-02-01 15:03 ` Hans Hagen
2009-02-02  4:35   ` Yue Wang [this message]
2009-02-02  8:47     ` Hans Hagen
2009-02-02  9:13       ` Yue Wang
2009-02-02 22:14         ` Taco Hoekwater
2009-02-01 15:47 ` Taco Hoekwater

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=68bfdc900902012035s3aee016eo34b70f94d75b112c@mail.gmail.com \
    --to=yuleopen@gmail.com \
    --cc=ntg-context@ntg.nl \
    /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).