1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-02 22:46:30 +02:00

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 <justus@g10code.com>
This commit is contained in:
Justus Winter 2017-04-20 15:04:52 +02:00
parent 10519270d3
commit 245860ecaf
No known key found for this signature in database
GPG key ID: DD1A52F9DA8C9020
2 changed files with 15 additions and 8 deletions

View file

@ -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. */