aboutsummaryrefslogtreecommitdiffstats
path: root/tests/gpgscm/scheme-private.h
diff options
context:
space:
mode:
authorJustus Winter <[email protected]>2017-04-20 13:04:52 +0000
committerJustus Winter <[email protected]>2017-04-24 12:14:01 +0000
commit245860ecaf8b9e82ca577385abd453ac92ffcd26 (patch)
tree2d3f978209d91a9999cb37ba2134c3c0ea4e537f /tests/gpgscm/scheme-private.h
parentg13: Fix for Solaris. (diff)
downloadgnupg-245860ecaf8b9e82ca577385abd453ac92ffcd26.tar.gz
gnupg-245860ecaf8b9e82ca577385abd453ac92ffcd26.zip
gpgscm: Avoid fruitless garbage collection cycles.
* tests/gpgscm/scheme-private.h (CELL_MINRECOVER): New macro. * tests/gpgscm/scheme.c (_get_cell): Move the heuristic to get more cells... (gc): ... here where every caller benefits from the optimization. Signed-off-by: Justus Winter <[email protected]>
Diffstat (limited to '')
-rw-r--r--tests/gpgscm/scheme-private.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/gpgscm/scheme-private.h b/tests/gpgscm/scheme-private.h
index 075dc70e9..bc0269ad2 100644
--- a/tests/gpgscm/scheme-private.h
+++ b/tests/gpgscm/scheme-private.h
@@ -108,6 +108,13 @@ int tracing;
#ifndef CELL_SEGSIZE
#define CELL_SEGSIZE 5000 /* # of cells in one segment */
#endif
+
+/* If less than # of cells are recovered in a garbage collector run,
+ * allocate a new cell segment to avoid fruitless collection cycles in
+ * the near future. */
+#ifndef CELL_MINRECOVER
+#define CELL_MINRECOVER (CELL_SEGSIZE >> 2)
+#endif
struct cell_segment *cell_segments;
/* We use 4 registers. */