From bfd40280723583c0b5013633cf4aa2108acccd97 Mon Sep 17 00:00:00 2001 From: Veit Heller Date: Sun, 26 Jul 2026 20:59:59 +0200 Subject: [PATCH] release 0.2.1 with automatic buffer cleanup --- .github/workflows/ci.yml | 2 +- README.md | 4 ++-- docs/StringBuf.html | 2 +- strbuf.carp | 3 ++- test/strbuf.carp | 10 +++++++++- 5 files changed, 15 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0fdd89c..b31c7db 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,7 +22,7 @@ jobs: - name: Run tests run: | set -euo pipefail - carp -x test/strbuf.carp + carp -x --log-memory test/strbuf.carp - name: Install angler run: | diff --git a/README.md b/README.md index 3bd27bc..694ea9d 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ A growable string buffer for Carp. ## Installation ```clojure -(load "git@github.com:carpentry-org/strbuf@0.2.0") +(load "git@github.com:carpentry-org/strbuf@0.2.1") ``` ## Usage @@ -45,7 +45,7 @@ allocates a new string on every call. ## Testing ``` -carp -x test/strbuf.carp +carp -x --log-memory test/strbuf.carp ```
diff --git a/docs/StringBuf.html b/docs/StringBuf.html index 6c13e0f..8710b7f 100644 --- a/docs/StringBuf.html +++ b/docs/StringBuf.html @@ -35,7 +35,7 @@

every call), StringBuf tracks capacity and grows geometrically, giving amortized O(1) appends.

Installation

-
(load "git@github.com:carpentry-org/strbuf@0.2.0")
+
(load "git@github.com:carpentry-org/strbuf@0.2.1")
 

Usage

(let [sb (StringBuf.create)]
diff --git a/strbuf.carp b/strbuf.carp
index d30fe12..5e81c0d 100644
--- a/strbuf.carp
+++ b/strbuf.carp
@@ -6,7 +6,7 @@ amortized O(1) appends.
 ## Installation
 
 ```
-(load \"git@github.com:carpentry-org/strbuf@0.2.0\")
+(load \"git@github.com:carpentry-org/strbuf@0.2.1\")
 ```
 
 ## Usage
@@ -77,6 +77,7 @@ modifying the buffer.")
 
   (doc delete "frees the buffer.")
   (register delete (Fn [StringBuf] ()))
+  (implements delete StringBuf.delete)
 
   (register copy (Fn [&StringBuf] StringBuf))
   (implements copy StringBuf.copy))
diff --git a/test/strbuf.carp b/test/strbuf.carp
index 1eeb8df..36f2f75 100644
--- a/test/strbuf.carp
+++ b/test/strbuf.carp
@@ -155,4 +155,12 @@
     &(let-do [sb (StringBuf.with-capacity 0)]
       (StringBuf.append-str &sb "hello")
       (let-do [s (StringBuf.to-string &sb)] (StringBuf.delete sb) s))
-    "with-capacity 0 buffer grows and is usable"))
+    "with-capacity 0 buffer grows and is usable")
+
+  (assert-equal test
+    0l
+    (do
+      (Debug.reset-memory-balance!)
+      (let [sb (StringBuf.create)] ())
+      (Debug.memory-balance))
+    "owned buffers are deleted automatically at scope exit"))