From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Memory usage report Date: Sat, 19 Sep 2020 19:05:53 +0300 Message-ID: <837dsp3g66.fsf@gnu.org> References: <87lfh8kyot.fsf@gnus.org> <87h7rwkxtk.fsf@gnus.org> <83imcb61p7.fsf@gnu.org> <871rizl5mf.fsf@gnus.org> <83r1qz48h3.fsf@gnu.org> <871rizjogr.fsf@gnus.org> <83pn6j45rr.fsf@gnu.org> <87wo0ri6kz.fsf@gnus.org> <83o8m34433.fsf@gnu.org> <87imcb43e3.fsf@localhost> <83k0wr4222.fsf@gnu.org> <87ft7f40p8.fsf@localhost> <83h7rv3xsc.fsf@gnu.org> <87wo0rdpud.fsf@localhost> <838sd6522b.fsf@gnu.org> <87tuvuehhq.fsf@localhost> <83wo0q2ohm.fsf@gnu.org> <87mu1lesy3.fsf@localhost> <83d02h3jj2.fsf@gnu.org> <87k0wper2r.fsf@localhost> <83a6xl3hji.fsf@gnu.org> <87h7rtepni.fsf@localhost> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="39102"; mail-complaints-to="usenet@ciao.gmane.io" Cc: larsi@gnus.org, emacs-devel@gnu.org To: Ihor Radchenko Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Sep 19 18:35:25 2020 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kJfpc-000A3C-Qd for ged-emacs-devel@m.gmane-mx.org; Sat, 19 Sep 2020 18:35:24 +0200 Original-Received: from localhost ([::1]:47524 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kJfpb-0007zt-Qy for ged-emacs-devel@m.gmane-mx.org; Sat, 19 Sep 2020 12:35:23 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:52962) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kJfNL-000417-BJ for emacs-devel@gnu.org; Sat, 19 Sep 2020 12:06:12 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:47214) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kJfNK-0008JX-Fk; Sat, 19 Sep 2020 12:06:11 -0400 Original-Received: from [176.228.60.248] (port=4253 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1kJfN7-0000kc-Od; Sat, 19 Sep 2020 12:06:00 -0400 In-Reply-To: <87h7rtepni.fsf@localhost> (message from Ihor Radchenko on Sat, 19 Sep 2020 23:45:37 +0800) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 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-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:256193 Archived-At: > From: Ihor Radchenko > Cc: larsi@gnus.org, emacs-devel@gnu.org > Date: Sat, 19 Sep 2020 23:45:37 +0800 > > >> Some of the overlays and text properties are not strictly necessary. > >> For example, text properties are sometimes used as cache to avoid > >> parsing text multiple times. Is the resulting speedup worth extra memory > >> usage? It is not clear since we do not have an easy way to determine the > >> extra memory usage. > > > > These are exactly the questions to ask the Org developers, I think. > > As an org developer, how can I know the extra memory usage by that one > specific type of text properties? No, you should be able to tell whether "the resulting speedup worth extra memory usage". The memory used by a single overlay can be easily determined by looking at the contents of an overlay object on the C level, and similarly with text properties. > > What that profiler counts is calls to memory-allocation functions, > > that's all. Without being able to account for memory which was freed > > after being allocated, these counts are useless. > > Got it. Then, I imagine that a simple delta of before/after running a > function could be used to build a more useful memory report. Current GC > report only provides the total usage, but no information on how > individual function calls increased the memory usage. Call garbage-collect before and after the function, and you can have that. > This might even be done in Elisp comparing `cons-cells-consed' and > similar variables before/after each function call. Not everything is exposed to Lisp. For example, how many bytes are consumed by a cons cell.