From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Jason Rumney Newsgroups: gmane.emacs.bugs Subject: bug#3208: 23.0.93; Memory full / crash when displaying lots of characters from a large font (like Arial Unicode or Code2000) which is not explicitly selected (on Win32) Date: Tue, 05 May 2009 23:25:24 +0800 Message-ID: <4A005A64.5050908@gnu.org> References: <49FF3340.2040008@gmx.de> Reply-To: Jason Rumney , 3208@emacsbugs.donarmstrong.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1241537543 22679 80.91.229.12 (5 May 2009 15:32:23 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 5 May 2009 15:32:23 +0000 (UTC) To: Michael Schierl , 3208@emacsbugs.donarmstrong.com Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue May 05 17:32:13 2009 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1M1Mcu-0006q0-Jg for geb-bug-gnu-emacs@m.gmane.org; Tue, 05 May 2009 17:32:12 +0200 Original-Received: from localhost ([127.0.0.1]:55481 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1M1Mcu-0002dl-1u for geb-bug-gnu-emacs@m.gmane.org; Tue, 05 May 2009 11:32:12 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1M1Mcp-0002ch-A1 for bug-gnu-emacs@gnu.org; Tue, 05 May 2009 11:32:07 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1M1Mck-0002Zn-Of for bug-gnu-emacs@gnu.org; Tue, 05 May 2009 11:32:06 -0400 Original-Received: from [199.232.76.173] (port=41818 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1M1Mck-0002Zc-HA for bug-gnu-emacs@gnu.org; Tue, 05 May 2009 11:32:02 -0400 Original-Received: from rzlab.ucr.edu ([138.23.92.77]:41359) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1M1Mcj-0006cC-KQ for bug-gnu-emacs@gnu.org; Tue, 05 May 2009 11:32:01 -0400 Original-Received: from rzlab.ucr.edu (rzlab.ucr.edu [127.0.0.1]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id n45FVr2F029138; Tue, 5 May 2009 08:31:55 -0700 Original-Received: (from debbugs@localhost) by rzlab.ucr.edu (8.13.8/8.13.8/Submit) id n45FU3CH027939; Tue, 5 May 2009 08:30:03 -0700 X-Loop: owner@emacsbugs.donarmstrong.com Resent-From: Jason Rumney Original-Sender: Jason Rumney Resent-To: bug-submit-list@donarmstrong.com Resent-CC: Emacs Bugs Resent-Date: Tue, 05 May 2009 15:30:03 +0000 Resent-Message-ID: Resent-Sender: owner@emacsbugs.donarmstrong.com X-Emacs-PR-Message: followup 3208 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Original-Received: via spool by 3208-submit@emacsbugs.donarmstrong.com id=B3208.124153717027699 (code B ref 3208); Tue, 05 May 2009 15:30:03 +0000 Original-Received: (at 3208) by emacsbugs.donarmstrong.com; 5 May 2009 15:26:10 +0000 X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. Original-Received: from mail-bw0-f205.google.com (mail-bw0-f205.google.com [209.85.218.205]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id n45FQ15r027665 for <3208@emacsbugs.donarmstrong.com>; Tue, 5 May 2009 08:26:03 -0700 Original-Received: by bwz1 with SMTP id 1so5459212bwz.1 for <3208@emacsbugs.donarmstrong.com>; Tue, 05 May 2009 08:25:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:message-id:date:from :user-agent:mime-version:to:subject:references:in-reply-to :content-type:content-transfer-encoding; bh=1pVR8xFhldCbQ0ylr7FB0UxXZTrfX2iBjfQs5dAwZrg=; b=Efh37Eagq7UgKwATQJasd208DfIrhj03hWubiiyM+kvWpIJrfPUexl0LKG+fuQlCDe iLWVZN/KcpUe24M6BJi+N9V2L6QSGBva/XMW4vArFjItw4p5rA/BAVWVZi2I2TwncSdz c/Jl+AIR9YRnFG52Bz8X3OT6RQsbLnutUwOCM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:message-id:date:from:user-agent:mime-version:to:subject :references:in-reply-to:content-type:content-transfer-encoding; b=DMOVbY0t4taTE1tPUYP2KFSg5ywLC+NxlO7WsZAbZs2iNEcKFEjJsjpw+iob6xJ+s+ ds7lM1xNe9uC54iVaMftELLPdYln1sYXsWo66yzD0O5h4S4UPU61wv1Ppu3sSJCYwkW2 seNaRlp5MfOgNQjITacfW7H2jpbgVvHTEp7x0= Original-Received: by 10.142.174.18 with SMTP id w18mr65839wfe.55.1241537154466; Tue, 05 May 2009 08:25:54 -0700 (PDT) Original-Received: from ?192.168.249.26? ([118.101.236.118]) by mx.google.com with ESMTPS id 24sm3040175wfc.37.2009.05.05.08.25.52 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 05 May 2009 08:25:54 -0700 (PDT) User-Agent: Thunderbird 2.0.0.21 (Windows/20090302) In-Reply-To: <49FF3340.2040008@gmx.de> X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) Resent-Date: Tue, 05 May 2009 11:32:06 -0400 X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:27718 Archived-At: Michael Schierl wrote: > - It is easier if you have one of the fonts Code2000 or Arial Unicode > installed. I tried it with fonts that come with Windows XP (like > Lucida Sans Unicode) but did not succeed in reproducing the bug. > It might happen with other fonts as well, most likely ones that have > lots of glyphs. > - You need to know a character that is in your font but not in the > default font (0x2203 works for both Arial Unicode and Code2000, 0x2202 > would work for Lucida Sans Unicode, 0xFFFD works for Arial Unicode). > - Start emacs -Q > - Insert a few thousand characters of that kind, and move to the > beginning and to the end of the buffer repeatedly. At first you > receive warnings like "Emergency (alloc): Warning: past 95% of memory > limit", then the memory is exhausted, and if you still go on, you will > be asked if you want to debug Emacs. This is perfectly reproducable > for me, both on my main machine and on a freshly installed WinXP > virtual machine where I only added Emacs and one of the fonts. > I can reproduce this. The malloc warnings always seem to occur in the SAFE_ALLOCA call in font_sort_entities. The vec passed in to that function contains all the fonts on my system, and len is over 3000, requiring 24kB to be allocated. There appear to be two bugs here. One is that this function is being called all the time when we have already found a font for the character we added to the buffer. The other is that SAFE_FREE does not appear to call xfree to free the memory that SAFE_ALLOCA allocated with xmalloc. Maybe SAFE_ALLOCA is not used often to allocate more than 16kB (the threshold for using the heap instead of the stack) so this has gone unnoticed in the past.