From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Uday S Reddy Newsgroups: gmane.emacs.devel Subject: Re: Memory leaks Date: Fri, 04 Mar 2011 11:39:05 +0000 Message-ID: <4D70CF59.4010406@cs.bham.ac.uk> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1299238772 26891 80.91.229.12 (4 Mar 2011 11:39:32 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 4 Mar 2011 11:39:32 +0000 (UTC) Cc: u.s.reddy@cs.bham.ac.uk To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Mar 04 12:39:27 2011 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.69) (envelope-from ) id 1PvTLw-0007DC-5u for ged-emacs-devel@m.gmane.org; Fri, 04 Mar 2011 12:39:24 +0100 Original-Received: from localhost ([127.0.0.1]:35395 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PvTLv-0005bS-Oc for ged-emacs-devel@m.gmane.org; Fri, 04 Mar 2011 06:39:23 -0500 Original-Received: from [140.186.70.92] (port=42813 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PvTLn-0005aB-ED for emacs-devel@gnu.org; Fri, 04 Mar 2011 06:39:16 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PvTLm-0002uQ-77 for emacs-devel@gnu.org; Fri, 04 Mar 2011 06:39:15 -0500 Original-Received: from lo.gmane.org ([80.91.229.12]:59318) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PvTLl-0002uE-R9 for emacs-devel@gnu.org; Fri, 04 Mar 2011 06:39:14 -0500 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1PvTLl-00077K-4k for emacs-devel@gnu.org; Fri, 04 Mar 2011 12:39:13 +0100 Original-Received: from cpc10-harb6-0-0-cust112.perr.cable.virginmedia.com ([92.232.137.113]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 04 Mar 2011 12:39:13 +0100 Original-Received: from u.s.reddy by cpc10-harb6-0-0-cust112.perr.cable.virginmedia.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 04 Mar 2011 12:39:13 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 250 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: cpc10-harb6-0-0-cust112.perr.cable.virginmedia.com User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.14) Gecko/20110221 Thunderbird/3.1.8 In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 80.91.229.12 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:136759 Archived-At: On 3/3/2011 11:40 PM, Andreas Schwab wrote: > How do you know that there is some leak? First there was a suspicion, and now I have been running experiments. Here are the profiles returned by (garbage-collect), pretty-printed, for the same Emacs session over time. In each case, the Emacs session was essentially empty, with just a few stray text buffers . The difference is only in what happened in between. Initial: (:conses (102590 . 13880) :syms (20328 . 54) :miscs (830 . 152) :chars 570345 :vector 329747 :floats (72 . 111) :intervals (348 . 189) :strings (21259 . 5705)) After one visit to my INBOX folder (22MB) and quitting: (:conses (663630 . 605600) :syms (32257 . 2608) :miscs (15443 . 18022) :chars 1639236 :vector 454670 :floats (345 . 261) :intervals (503 . 622) :strings (99122 . 90256)) After a second visit to the same folder and quitting: (:conses (1113362 . 334402) :syms (32264 . 2807) :miscs (15467 . 36265) :chars 1833568 :vector 456351 :floats (345 . 328) :intervals (604 . 849) :strings (138140 . 122806)) After several hours of usage: (:conses (1558351 . 313757) :syms (93011 . 347) :miscs (140492 . 28025) :chars 9264181 :vector 2283330 :floats (347 . 638) :intervals (2771 . 4880) :strings (467731 . 34316)) At this point, the total memory occupied was about 400MB, and Emacs complained that "memory was exhausted; save buffers and quit" (or something to that effect). I ran garbage-collect, killed all the stray buffers and left it around for a while (about 10-15 minutes), and the memory came down to 340MB. (The memory usage figures are from the Windows XP Task Manger - "VM Size" - VM here referring to the virtual memory.) After that, I could do a couple of more folder visits and then Emacs crashed in the middle of a folder visit. Come to think of it, almost all the Emacs crashes I have experienced over the last year or so were probably related to the memory leak problem. They all happened when I was visiting a folder. Recalling from my memory, these kind of crashes have started happening with Emacs 22.3. There were no such crashes before then. I stuck to Emacs 22.2 for a long time, hoping that whatever was causing the crashes would get fixed in due course. But with every new release, the same kind of crashes appeared. Here is a crash report from yesterday produced by DrMinGW. Unfortunately, I was in the middle of a Lisp debugger session and the crash happened while the debugger was trying print a large data structure. But this does look like a memory problem to my untrained eye. Cheers, Uday --------------- emacs.exe caused an Access Violation at location 77c47412 in module msvcrt.dll Writing to location 18874000. Registers: eax=00829240 ebx=02bb2802 ecx=00000000 edx=00000001 esi=008292bf edi=18874000 eip=77c47412 esp=00829290 ebp=00829298 iopl=0 nv up ei ng nz ac pe cy cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000 efl=00000293 Call stack: 77C47412 msvcrt.dll:77C47412 memmove 0110AD0F emacs.exe:0110AD0F printchar print.c:323 0110FC03 emacs.exe:0110FC03 print_object print.c:1645 011105A3 emacs.exe:011105A3 print_object print.c:1921 0111148E emacs.exe:0111148E print_object print.c:2215 0111148E emacs.exe:0111148E print_object print.c:2215 011105A3 emacs.exe:011105A3 print_object print.c:1921 0111148E emacs.exe:0111148E print_object print.c:2215 0111148E emacs.exe:0111148E print_object print.c:2215 011105A3 emacs.exe:011105A3 print_object print.c:1921 0111148E emacs.exe:0111148E print_object print.c:2215 0111148E emacs.exe:0111148E print_object print.c:2215 011105A3 emacs.exe:011105A3 print_object print.c:1921 0111148E emacs.exe:0111148E print_object print.c:2215 0111148E emacs.exe:0111148E print_object print.c:2215 011105A3 emacs.exe:011105A3 print_object print.c:1921 0111148E emacs.exe:0111148E print_object print.c:2215 0111148E emacs.exe:0111148E print_object print.c:2215 011105A3 emacs.exe:011105A3 print_object print.c:1921 0111148E emacs.exe:0111148E print_object print.c:2215 0111148E emacs.exe:0111148E print_object print.c:2215 011105A3 emacs.exe:011105A3 print_object print.c:1921 0111148E emacs.exe:0111148E print_object print.c:2215 0111148E emacs.exe:0111148E print_object print.c:2215 011105A3 emacs.exe:011105A3 print_object print.c:1921 0111148E emacs.exe:0111148E print_object print.c:2215 0111148E emacs.exe:0111148E print_object print.c:2215 011105A3 emacs.exe:011105A3 print_object print.c:1921 0111148E emacs.exe:0111148E print_object print.c:2215 0111148E emacs.exe:0111148E print_object print.c:2215 011105A3 emacs.exe:011105A3 print_object print.c:1921 0111148E emacs.exe:0111148E print_object print.c:2215 0111148E emacs.exe:0111148E print_object print.c:2215 011105A3 emacs.exe:011105A3 print_object print.c:1921 0110EAE2 emacs.exe:0110EAE2 print print.c:1305 0110CF92 emacs.exe:0110CF92 Fprin1 print.c:751 01022B04 emacs.exe:01022B04 Ffuncall eval.c:3034 01114C11 emacs.exe:01114C11 Fbyte_code bytecode.c:680 010232C3 emacs.exe:010232C3 funcall_lambda eval.c:3220 01022D03 emacs.exe:01022D03 Ffuncall eval.c:3077 01114C11 emacs.exe:01114C11 Fbyte_code bytecode.c:680 01021B46 emacs.exe:01021B46 Feval eval.c:2356 0101ED68 emacs.exe:0101ED68 Fprogn eval.c:415 01102A41 emacs.exe:01102A41 Fsave_window_excursion window.c:6575 0111579A emacs.exe:0111579A Fbyte_code bytecode.c:841 010232C3 emacs.exe:010232C3 funcall_lambda eval.c:3220 01022D03 emacs.exe:01022D03 Ffuncall eval.c:3077 010221D6 emacs.exe:010221D6 Fapply eval.c:2506 010225FD emacs.exe:010225FD apply1 eval.c:2780 0101EB72 emacs.exe:0101EB72 call_debugger eval.c:272 01022E12 emacs.exe:01022E12 Ffuncall eval.c:3102 01114C11 emacs.exe:01114C11 Fbyte_code bytecode.c:680 01021B46 emacs.exe:01021B46 Feval eval.c:2356 01020165 emacs.exe:01020165 internal_catch eval.c:1228 0111580E emacs.exe:0111580E Fbyte_code bytecode.c:855 010232C3 emacs.exe:010232C3 funcall_lambda eval.c:3220 01022D03 emacs.exe:01022D03 Ffuncall eval.c:3077 010221D6 emacs.exe:010221D6 Fapply eval.c:2506 010225FD emacs.exe:010225FD apply1 eval.c:2780 01117B84 emacs.exe:01117B84 Fcall_interactively callint.c:396 01022B2E emacs.exe:01022B2E Ffuncall eval.c:3037 010226CC emacs.exe:010226CC call3 eval.c:2857 01014D52 emacs.exe:01014D52 Fcommand_execute keyboard.c:10562 010150C3 emacs.exe:010150C3 Fexecute_extended_command keyboard.c:10675 01022AE3 emacs.exe:01022AE3 Ffuncall eval.c:3031 0111932A emacs.exe:0111932A Fcall_interactively callint.c:869 01022B2E emacs.exe:01022B2E Ffuncall eval.c:3037 010226CC emacs.exe:010226CC call3 eval.c:2857 01014D52 emacs.exe:01014D52 Fcommand_execute keyboard.c:10562 010076E0 emacs.exe:010076E0 command_loop_1 keyboard.c:1914 01020614 emacs.exe:01020614 internal_condition_case eval.c:1492 01005FE3 emacs.exe:01005FE3 command_loop_2 keyboard.c:1362 01020165 emacs.exe:01020165 internal_catch eval.c:1228 01005F9C emacs.exe:01005F9C command_loop keyboard.c:1342 0100588E emacs.exe:0100588E recursive_edit_1 keyboard.c:956 010059F7 emacs.exe:010059F7 Frecursive_edit keyboard.c:1019 010028F5 emacs.exe:010028F5 main emacs.c:1835 010010DB emacs.exe:010010DB 01001178 emacs.exe:01001178 010036D0 emacs.exe:010036D0 _start unexw32.c:131 7C817077 kernel32.dll:7C817077 RegisterWaitForInputIdle