From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Alex Gramiak Newsgroups: gmane.emacs.devel Subject: Re: NS port: How to debug excessive garbage collection? Date: Mon, 15 Apr 2019 23:26:05 -0600 Message-ID: <875zrejzbm.fsf@gmail.com> References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="241481"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux) Cc: eliz@gnu.org, emacs-devel@gnu.org To: Keith David Bershatsky Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Apr 16 07:26:54 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hGGcQ-0010eu-C8 for ged-emacs-devel@m.gmane.org; Tue, 16 Apr 2019 07:26:54 +0200 Original-Received: from localhost ([127.0.0.1]:59575 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hGGcK-0006wZ-0j for ged-emacs-devel@m.gmane.org; Tue, 16 Apr 2019 01:26:48 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:46207) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hGGbj-0006wS-I1 for emacs-devel@gnu.org; Tue, 16 Apr 2019 01:26:14 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hGGbi-0006sB-LI for emacs-devel@gnu.org; Tue, 16 Apr 2019 01:26:11 -0400 Original-Received: from mail-pf1-x443.google.com ([2607:f8b0:4864:20::443]:44605) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hGGbi-0006rO-Bw; Tue, 16 Apr 2019 01:26:10 -0400 Original-Received: by mail-pf1-x443.google.com with SMTP id y13so9768651pfm.11; Mon, 15 Apr 2019 22:26:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=fQd+2d43pCJVpzABPgbnIJqIunfzi0TTap4jc08sWqU=; b=SGUWSnw363tOouA5cyXa3U0oo2OctNg8gEDjGJ8EKUFe27SwPXWAQK6jWZ8pwRurrd HD+gYQ9JZ///v15HKt+KO5wNNg6AhO2GZ/GmU/OciM8C4VRm/wjaaQ+rdpbq58x5nxSr +g0JA+EKCIjn9NlIxdRNHRte4TEvSk3VJbJZFqhLORAp9+r9Xjvi1NEmGF3MmI2LQvJn Smu9eHJtC1aMeJBq043WEzybG7beJ4texXbIKZctyIjJaUCRCQK6C6S1V33wA+NOCV7d iM26IRQW7FE8jqfNOctuKrMX26hvqzrlnRXJ4uj/BqDeG+Lo1mfCWxtEpdpH9VxJ4rSg Evrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=fQd+2d43pCJVpzABPgbnIJqIunfzi0TTap4jc08sWqU=; b=aBcvgGLsYcx4oDaP9xqMrhqVFXs/TxPmEUeGeWvfHUXek0qtY6+AVB9pnK+Lu26+qz hAHopbBR8e34n98USERTMYJMvEvJBGaJscl7iV+gO1x+xsH6S4v+g9mUJ9fnsEYW3sC/ KVgZN9tELJZy13aid1326LiOJ1cH00OysBNZL8ZHFg2ig7V/fc0HtEf62s0k8vEyz148 U6zj9ayQkTaktJ4pfOUh9EVl8I8hkitsUpQCRcSAE3wOVDEyh5yXnqIFs9TtZqF6o5e+ fzRuHS5DPfC5LKwtbwbSdfSQMPvIpR/mVTfs8ncNG4TtiLEu45RPwXLLt0TKJg8zW/Bx UqJQ== X-Gm-Message-State: APjAAAVkjOLlNvFFpJpyivHheKtMdTjYQ1KkNrnh5k43m+5kiJmgsz3d 8fulZ9mI0EfzG4HcWbw7AIfbJkMr X-Google-Smtp-Source: APXvYqyd0JpfLshPzUfMR1P1ECa9l6xWL5XKLbf4Ef+s22+JROFfuUeOAM9hOs2R6zZOL8aesWvQxA== X-Received: by 2002:a63:ff0f:: with SMTP id k15mr73631142pgi.407.1555392368425; Mon, 15 Apr 2019 22:26:08 -0700 (PDT) Original-Received: from lylat ([2604:3d09:e37f:1500:1a72:4878:e793:7302]) by smtp.gmail.com with ESMTPSA id q75sm40468038pfi.102.2019.04.15.22.26.06 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 15 Apr 2019 22:26:07 -0700 (PDT) In-Reply-To: (Keith David Bershatsky's message of "Mon, 15 Apr 2019 19:57:48 -0700") X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::443 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 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" Xref: news.gmane.org gmane.emacs.devel:235506 Archived-At: Keith David Bershatsky writes: > I am working on implementing the suggestion of Alex to use structures to store > the data for each fake cursor on a per window basis, instead of the prior method > that created a Lisp_Object of cons cells (causing the excessive garbage > collection issue). > > It seemed to me that the implementation of creating the vector to store glyph > rows looked somewhat similar to what we want to do here. I attempted to borrow a > portion of that vector glyph row implementation in the attached working example > that applies to the master branch as of 04/08/2019 > (a038df77de7b1aa2d73a6478493b8838b59e4982). > > I had hoped to keep the cache (w->mc_elts) alive for the duration that the fake > cursors feature is active in a visible window. However, the cache (w->mc_elts) > disappears and becomes NULL. In the attached example, whenever it is time to > increase the size of the dynamic vector, I set the value of w->mc_elts[99].x to > 99. The value of -1 is used in the stderr printout whenever w->mc_elts is NULL. The problem here is that since you changed the single struct cache to an array of caches, you need to also change the memset call to match it. Right now you are setting the pointer variable to 0/NULL. It should now be: memset (w->mc_elts, 0, w->mc_nelts * (sizeof *w->mc_elts)); Which sets the memory block of mc_nelts cache structs pointed to by mc_elts to 0.