From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ted Zlatanov Newsgroups: gmane.emacs.devel Subject: Re: fixing memory leaks before the pretest Date: Mon, 09 Jan 2012 19:59:22 -0500 Organization: =?utf-8?B?0KLQtdC+0LTQvtGAINCX0LvQsNGC0LDQvdC+0LI=?= @ Cienfuegos Message-ID: <87obucid91.fsf@lifelogs.com> References: <87vcookmxd.fsf@gnu.org> <87lipjr5jk.fsf_-_@lifelogs.com> <87sjjrzf6a.fsf@gnu.org> Reply-To: emacs-devel@gnu.org NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1326157191 20378 80.91.229.12 (10 Jan 2012 00:59:51 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 10 Jan 2012 00:59:51 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jan 10 01:59:47 2012 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1RkQ41-0004sE-KD for ged-emacs-devel@m.gmane.org; Tue, 10 Jan 2012 01:59:45 +0100 Original-Received: from localhost ([::1]:34925 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RkQ41-0002gH-4q for ged-emacs-devel@m.gmane.org; Mon, 09 Jan 2012 19:59:45 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:55831) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RkQ3y-0002g1-9O for emacs-devel@gnu.org; Mon, 09 Jan 2012 19:59:43 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RkQ3w-0006vN-VV for emacs-devel@gnu.org; Mon, 09 Jan 2012 19:59:42 -0500 Original-Received: from lo.gmane.org ([80.91.229.12]:48197) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RkQ3w-0006vH-Mt for emacs-devel@gnu.org; Mon, 09 Jan 2012 19:59:40 -0500 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1RkQ3v-0004od-EE for emacs-devel@gnu.org; Tue, 10 Jan 2012 01:59:39 +0100 Original-Received: from c-76-28-40-19.hsd1.vt.comcast.net ([76.28.40.19]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 10 Jan 2012 01:59:39 +0100 Original-Received: from tzz by c-76-28-40-19.hsd1.vt.comcast.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 10 Jan 2012 01:59:39 +0100 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: emacs-devel@gnu.org Original-Lines: 53 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: c-76-28-40-19.hsd1.vt.comcast.net X-Face: bd.DQ~'29fIs`T_%O%C\g%6jW)yi[zuz6; d4V0`@y-~$#3P_Ng{@m+e4o<4P'#(_GJQ%TT= D}[Ep*b!\e,fBZ'j_+#"Ps?s2!4H2-Y"sx" Mail-Copies-To: never User-Agent: Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.90 (gnu/linux) Cancel-Lock: sha1:U+h6/1k+4VLGJ4343btgzxlHbuU= 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.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:147536 Archived-At: On Sat, 07 Jan 2012 23:49:01 +0800 Chong Yidong wrote: CY> Ted Zlatanov writes: >> I am seeing memory growth on GNU/Linux with Gnus and GnuTLS that I >> don't see otherwise without Gnus, so it's faintly possible GnuTLS is >> not the determining factor. I have gone over the gnutls.c code and >> don't see where the GnuTLS glue could be leaking. CY> Do you have a test case for, e.g. creating and closing a few thousand CY> GnuTLS connections to a localhost running apache with https and seeing CY> if there is any memory impact? That would be the first thing I would CY> try, but I haven't had the time to look into this. I did, to a Dovecot IMAP server: #+begin_src lisp (require 'gnutls) (setq gnutls-log-level 10) (dotimes (n 10000) (setq buf (open-gnutls-stream "tls" "tls-buffer" "myserver" "imaps")) (delete-process buf)) #+end_src It took a while, but throughout the memory usage remained consistently at 331 MB virtual, 53 MB resident, 15 MB shared. Once the loop ended and Emacs calmed down, virtual was the same but resident dropped to 39 MB and shared was 4 MB. By comparison a new Emacs without any GnuTLS initialization is 320 MB virtual, 45 MB resident, and 14 MB shared. Based on that, I don't think there are obvious GnuTLS leaks in the connection open/close sequence. There may be leaks in the packet handling, though. I tried: #+begin_src lisp (dotimes (n 10000) (setq buf (open-gnutls-stream "tls" "tls-buffer" "myserver" "imaps")) (process-send-string buf "hello there") (sit-for 1) (message (with-current-buffer (process-buffer buf) (buffer-string))) (delete-process buf)) #+end_src and did not see a difference in the memory usage either (331/53/10). The IMAP server's greetings definitely came through, so the test was exercising the connection. This does not necessarily mean there are no leaks, but if they exist, they are probably not large or don't happen with the first few packets exchanged. I can look at this further... let me know what tests I should do. I'd like to prove there are leaks at all. Thanks Ted