Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wBsNx-001SLx-0h for pgsql-hackers@arkaria.postgresql.org; Sun, 12 Apr 2026 10:49:49 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wBsNt-001wiZ-1W for pgsql-hackers@arkaria.postgresql.org; Sun, 12 Apr 2026 10:49:46 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wBsNt-001wiQ-0H for pgsql-hackers@lists.postgresql.org; Sun, 12 Apr 2026 10:49:46 +0000 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wBsNr-00000000eZj-2MnZ for pgsql-hackers@lists.postgresql.org; Sun, 12 Apr 2026 10:49:45 +0000 Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-43d75312379so168711f8f.1 for ; Sun, 12 Apr 2026 03:49:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1775990980; x=1776595780; darn=lists.postgresql.org; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=a8aJrQci5JouKo2bVDgkY9LwMZgPngyj/LjttXtrCh8=; b=oFduGD2TiSzjD6kWsMbxdGarPEhI8JVyClBwWlNPxg0uzt83NrOU49IYpAqTJF4TLz Gof/5ZRU21scI1Xj1SUb2bD2aVK/LhfwbOhuEaMAbPPp/6Ey4pcUPdddtwLd0YauWPc4 66Fosf1m8m5h3KEUbiSNj3XIhJLNuX45pKaWSQMO38oumRuqWK+K2u+ptNDSb5zT0+cG +Yl+F4jsRHCyaGtjql4LFCTqyLWNQZecSNITRW0mY5E/FiRdXBJvxq35eQ5woH+Sf1ui M96qVXXSMsIrfJxVaFdjMX2xlB7qwCfNG0fEr1cDbveJq0BxMmep8BxXUqUlcVEgW7ZP cjVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775990980; x=1776595780; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=a8aJrQci5JouKo2bVDgkY9LwMZgPngyj/LjttXtrCh8=; b=ryDhEaMr5TrWHWayYojS3DyVKKQcC839xLxt2quZJm8onQJLiWPbUa5Fn0DlazfKpy uREdccpwcjPJkg013HPDYnMz5qt8URRPReR/i4p8lMDsJdTfDPbShgbVP13Gecfcc6kh H7hy2Pgn/EkRgjH4XElwL+HJl5I5rgxa0hGY4WTu9keyk74DMEJBllV8lM9jHFYwLL78 Ea6rNwylw/MRgkO8QBxfO9t/qt4RBbPhuN0vja/dDgCjIwemZYGYfFh0N5/w3MZyGqi4 H/KutMc8lCBcwsbwhahgOszh6ezlgC7pUJUM3mXJYMSh9wFFUhOZryUjnrERCMPtDT57 bsgQ== X-Gm-Message-State: AOJu0Yw1XyUtfFGD5vBcD6uWcizAFH4mXUd91BTLyHYcrikWbHSSTPHC 6j9LauAWH+1H1BOwQPZkQVc/jJjHvqwDzri5nQzN71n0H+YuiXmxFuAsM9fG3w== X-Gm-Gg: AeBDies9UBH1uJQdEKto6h2+w7HxZkbTZNACjjxjugf45IZZYmcpbRG1ABPqBhgXbmZ XUJipon/mmz3+Y13BvEy7haTe2fUtctmqrfZmWuWH0eJVHm4nh8oJM4FCo0rXxSKq176diyB70g 7rkiUhUAUYeEb1nruaX0R/3sNow4mCT2XBnZw9ggf0oJRL1hp+s1V4t2I82O0xKmKIi7F5Bkx4I AV4gxwI2nkjoUsX+M671LLkeXW0B4hr8l/lX7HQPSlpooPcd55WkzMOJskKeQqgfbTFZd/2XYrA Nw4zTrcQ+AZabKSpi+WJHkgSsjgQmm6GCp/FU4Jvn6LiXEsj8lX/GmMWLnFM0NGQ66zqvM2Io41 cnmh7XRfePVE5kZwoyGKfvBEOAmE889SULuzMiTunsKrXQ6JmPZxwi57NHNMQTMCrZeEiQBlCBX 9PokWwYkF7NLdI8SGi2rk1SsaEWm8/3/evvt8ESeHuyVayW5QfmOGLGFCznIvdMk0C9RdCl2mzz zI3xm40HRtHKz2fMe0qoNnWzLEt/hVYmacZBeeobjNjjKHXHY5kMpqzWg== X-Received: by 2002:a05:600c:444b:b0:488:9c3b:ff40 with SMTP id 5b1f17b1804b1-488d6acd9fbmr102267155e9.15.1775990980397; Sun, 12 Apr 2026 03:49:40 -0700 (PDT) Received: from ip-10-97-1-34.eu-west-3.compute.internal (ec2-15-237-197-144.eu-west-3.compute.amazonaws.com. [15.237.197.144]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-488d5df2062sm70765495e9.12.2026.04.12.03.49.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Apr 2026 03:49:39 -0700 (PDT) Date: Sun, 12 Apr 2026 10:49:38 +0000 From: Bertrand Drouvot To: pgsql-hackers@lists.postgresql.org Cc: David Rowley Subject: Use stack allocated StringInfoDatas, where possible (round 2) Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="wggHK0nYArblB/da" Content-Disposition: inline List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --wggHK0nYArblB/da Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi hackers, Commit 6d0eba66275 already did most of the changes but missed the opportunities to $SUBJECT in sequencesync.c. Indeed, 5509055d6956 added a few cases that are using StringInfo but don't need that StringInfo to exist beyond the scope of the function were using makeStringInfo(), which allocates both a StringInfoData and the buffer it uses as two separate allocations. It's more efficient for these cases to use a StringInfoData on the stack and initialize it with initStringInfo(), which only allocates the string buffer. The reason 6d0eba66275 missed those is that 5509055d6956 has been committed between the patch proposal for 6d0eba66275 and 6d0eba66275. I used Mats's coccinelle script (mentioned in [1]) to find those and they are the only remaining ones. [1]: https://postgr.es/m/4379aac8-26f1-42f2-a356-ff0e886228d3%40gmail.com Regards, -- Bertrand Drouvot PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com --wggHK0nYArblB/da Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v1-0001-Use-stack-allocated-StringInfoDatas-where-possibl.patch"