From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Angelo Graziosi Newsgroups: gmane.emacs.devel Subject: Re: Warning starting Emacs (Cygwin) Date: Sat, 02 Aug 2008 16:29:10 +0200 Message-ID: <48946F36.3020505@alice.it> References: <4891D01B.6070802@alice.it> <4891E7E8.1000503@alice.it> <200807311700.m6VH0eCa004994@sallyv1.ics.uci.edu> <4892E7BE.1080706@alice.it> <489306EE.7090800@alice.it> <200808011308.m71D8PA3023871@sallyv1.ics.uci.edu> <489319F7.5040101@alice.it> <200808011436.m71EaAeZ019293@sallyv1.ics.uci.edu> <4893765E.5020803@alice.it> <200808020406.m7246D1T003058@sallyv1.ics.uci.edu> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1217687403 18981 80.91.229.12 (2 Aug 2008 14:30:03 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 2 Aug 2008 14:30:03 +0000 (UTC) Cc: Chong Yidong , emacs-devel@gnu.org To: Dan Nicolaescu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Aug 02 16:30:53 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1KPI87-0000LM-2e for ged-emacs-devel@m.gmane.org; Sat, 02 Aug 2008 16:30:47 +0200 Original-Received: from localhost ([127.0.0.1]:37611 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KPI7C-0000Ih-8D for ged-emacs-devel@m.gmane.org; Sat, 02 Aug 2008 10:29:50 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KPI78-0000H8-D7 for emacs-devel@gnu.org; Sat, 02 Aug 2008 10:29:46 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KPI77-0000EG-4t for emacs-devel@gnu.org; Sat, 02 Aug 2008 10:29:46 -0400 Original-Received: from [199.232.76.173] (port=60990 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KPI77-0000E8-0M for emacs-devel@gnu.org; Sat, 02 Aug 2008 10:29:45 -0400 Original-Received: from smtp-out26.alice.it ([85.33.2.26]:4595) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KPI76-0006fr-GD for emacs-devel@gnu.org; Sat, 02 Aug 2008 10:29:44 -0400 Original-Received: from FBCMMO03.fbc.local ([192.168.68.197]) by smtp-out26.alice.it with Microsoft SMTPSVC(6.0.3790.1830); Sat, 2 Aug 2008 16:29:43 +0200 Original-Received: from FBCMCL01B06.fbc.local ([192.168.69.87]) by FBCMMO03.fbc.local with Microsoft SMTPSVC(6.0.3790.1830); Sat, 2 Aug 2008 16:29:42 +0200 Original-Received: from [87.1.235.208] ([87.1.235.208]) by FBCMCL01B06.fbc.local with Microsoft SMTPSVC(6.0.3790.1830); Sat, 2 Aug 2008 16:29:41 +0200 User-Agent: Thunderbird 2.0.0.16 (Windows/20080708) In-Reply-To: <200808020406.m7246D1T003058@sallyv1.ics.uci.edu> X-OriginalArrivalTime: 02 Aug 2008 14:29:41.0962 (UTC) FILETIME=[33BCC2A0:01C8F4AC] X-detected-kernel: by monty-python.gnu.org: Windows 2000 SP4, XP SP1+ X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:101955 Archived-At: Dan Nicolaescu ha scritto: > Angelo Graziosi writes: > > > So if you have simple suggestions I will try. > > Thanks. > > I don't know anything about the code in question, and it looks like it > hasn't been touched in a while... > > But please look at src/vm-limit.c:check_memory_limits and see why it > prints that memory full message. It's not too many lines of code. This is what I have done. The first thing has been to verify what code is executed in 'check_memory_limits'. Using #ifdef HAVE_GETRLIMIT ... dataa_size = rlimit.rlim_cur; /* instead of data_size */ #else /* not HAVE_GETRLIMIT */ ... dataaa_size = (char *) cp - (char *) data_space_start; #endif /* not HAVE_GETRLIMIT */ the compiler fails on: 1) 'dataa_size', when src/config.in has #undef HAVE_GETRLIMIT (in current CVS trunk) and Emacs warns starting; 2) 'dataaa_size', when I remove #undef HAVE_GETRLIMIT (previous CVS) and Emacs starts normally. So the warning results when this code is executed: #ifdef HAVE_GETRLIMIT struct rlimit rlimit; getrlimit (RLIMIT_AS, &rlimit); if (RLIM_INFINITY == rlimit.rlim_max) return; /* This is a nonsensical case, but it happens -- rms. */ if (rlimit.rlim_cur > rlimit.rlim_max) return; five_percent = rlimit.rlim_max / 20; data_size = rlimit.rlim_cur; #else /* not HAVE_GETRLIMIT */ ... #endif /* not HAVE_GETRLIMIT */ ... if (data_size > five_percent * 19) new_warnlevel = warned_95; with 'data_size > five_percent * 19' (note 5%*19 == 95%). Since the code is very simple, the only thing I can think is that 'getrlimit' returns wrong values in struct 'rlimit' The obvious thing to do is to know the values of: data_size, five_percent, rlimit.rlim_cur, rlimit.rlim_max so I have tried to add ... five_percent = rlimit.rlim_max / 20; data_size = rlimit.rlim_cur; printf("have getrlimit %lu, %lu %lu %lu\n", data_size,five_percent,rlimit.rlim_cur,rlimit.rlim_max); and rebuild... but 'temacs' stack dumps...; perhaps a known problem since unicode branch was merged to trunk and solved in 'sheap.c 'with -#define STATIC_HEAP_SIZE (12 * 1024 * 1024) +#define STATIC_HEAP_SIZE (25 * 1024 * 1024) In this case I have tried up to (45 * 1024 * 1024) without success. Then I have tried with GDB: ------------------------------------------ $ gdb build/src/emacs.exe GNU gdb 6.8.0.20080328-cvs (cygwin-special) Copyright (C) 2008 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "i686-pc-cygwin"... (gdb) break check_memory_limits Breakpoint 1 at 0x56db96: file /work/emacs/src/vm-limit.c, line 159. (gdb) run -Q Starting program: /work/build/src/emacs.exe -Q [New thread 556.0xa0c] [New thread 556.0xcc4] [New thread 556.0x8d8] [New thread 556.0xdac] [New thread 556.0xb80] [New thread 556.0xe00] [New thread 556.0x1b4] ------------------------------------------ GDB does not stop on 'check_memory_limits' which is executed with the warning, and it does not return the prompt '(gdb)'. At the end I have tried this simple test case, which is 'out context' (so it could be not meaningful), but it seems to return wrong values: ----------------------------------------------- $ cat test_printf.c #include #include int main() { struct rlimit rlimit; unsigned long five_percent; unsigned long data_size; getrlimit (RLIMIT_AS, &rlimit); if (RLIM_INFINITY == rlimit.rlim_max) return 1; /* This is a nonsensical case, but it happens -- rms. */ if (rlimit.rlim_cur > rlimit.rlim_max) return 2; five_percent = rlimit.rlim_max / 20; data_size = rlimit.rlim_cur; printf("have getrlimit %lu, %lu %lu %lu\n", data_size,five_percent,rlimit.rlim_cur,rlimit.rlim_max); if (data_size > five_percent * 19) printf("past 95 percent of memory limit\n"); return 0; } $ gcc -o test_printf test_printf.c $ ./test_printf have getrlimit 2147483648, 107374182 2147483648 2147483648 past 95 percent of memory limit ----------------------------------------------- Cheers, Angelo. --- ... e la terra ritornata alla forma di nebulosa errerą nei cieli priva di parassiti e di malattie. . Italo SVEVO, "La coscienza di Zeno"