1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-03-26 08:41:47 -07:00

Turn off the spare memory on the mvff pool so that it returns freed memory to the arena immediately.

Free the initial allocations so that the result determination is accurate.

Copied from Perforce
 Change: 187206
 ServerID: perforce.ravenbrook.com
This commit is contained in:
Gareth Rees 2014-10-11 00:57:28 +01:00
parent 4b52294773
commit d2b4f1992f
2 changed files with 30 additions and 13 deletions

View file

@ -17,10 +17,6 @@ END_HEADER
#include "mpsavm.h"
#define MVFF_HI_PARMS EXTEND,AVGSIZE,MPS_PF_ALIGN,1,1,0
#define MVFF_LO_PARMS EXTEND,AVGSIZE,MPS_PF_ALIGN,0,0,1
enum {
SPARE_EMPTY,
SPARE_LESS,
@ -116,13 +112,27 @@ static void t_alloc(int spare, int spare_total, int commit, int obj_size) {
/* create low and high pools */
die(
mps_pool_create(&poolhi, arena, mps_class_mvff(), MVFF_HI_PARMS),
"create high pool");
MPS_ARGS_BEGIN(args) {
MPS_ARGS_ADD(args, MPS_KEY_EXTEND_BY, EXTEND);
MPS_ARGS_ADD(args, MPS_KEY_MEAN_SIZE, AVGSIZE);
MPS_ARGS_ADD(args, MPS_KEY_MVFF_ARENA_HIGH, 1);
MPS_ARGS_ADD(args, MPS_KEY_MVFF_SLOT_HIGH, 1);
MPS_ARGS_ADD(args, MPS_KEY_MVFF_FIRST_FIT, 0);
MPS_ARGS_ADD(args, MPS_KEY_SPARE, 0.0);
die(mps_pool_create_k(&poolhi, arena, mps_class_mvff(), args),
"create high pool");
} MPS_ARGS_END(args);
die(
mps_pool_create(&poollo, arena, mps_class_mvff(), MVFF_LO_PARMS),
"create low pool");
MPS_ARGS_BEGIN(args) {
MPS_ARGS_ADD(args, MPS_KEY_EXTEND_BY, EXTEND);
MPS_ARGS_ADD(args, MPS_KEY_MEAN_SIZE, AVGSIZE);
MPS_ARGS_ADD(args, MPS_KEY_MVFF_ARENA_HIGH, 0);
MPS_ARGS_ADD(args, MPS_KEY_MVFF_SLOT_HIGH, 0);
MPS_ARGS_ADD(args, MPS_KEY_MVFF_FIRST_FIT, 1);
MPS_ARGS_ADD(args, MPS_KEY_SPARE, 0.0);
die(mps_pool_create_k(&poollo, arena, mps_class_mvff(), args),
"create low pool");
} MPS_ARGS_END(args);
/* flush hysteresis fund, then set limit */
@ -130,10 +140,12 @@ static void t_alloc(int spare, int spare_total, int commit, int obj_size) {
mps_arena_spare_commit_limit_set(arena, SPARE_LIMIT);
/* allocate something in each pool (to reduce risk of subsidiary
allocation being neede later */
allocation being needed later) */
die(mps_alloc(&objlo, poollo, EXTEND), "low alloc");
mps_free(poollo, objlo, EXTEND);
die(mps_alloc(&objhi, poolhi, EXTEND), "high alloc");
mps_free(poolhi, objhi, EXTEND);
/* set up spare committed the way we want it */
@ -181,7 +193,12 @@ static void t_alloc(int spare, int spare_total, int commit, int obj_size) {
}
if (res != res_expected) {
comment("Spare useful/total %i/%i. Limit %i. Size %i. Expected %s. Got %s", spare, spare_total, commit, obj_size, err_text(res_expected), err_text(res));
comment("hisize=%lu losize=%lu\n"
"comsize=%lu comlimit=%lu\n"
"Expected %s. Got %s",
(unsigned long)hisize, (unsigned long)losize,
(unsigned long)comsize, (unsigned long)comlimit,
err_text(res_expected), err_text(res));
report("failed", "yes");
}

View file

@ -151,7 +151,7 @@ function/165.c
% 166 -- no such test
function/167.c
% 168-169 -- no such test
% function/170.c -- commit limit logic seems wrong @@@@
function/170.c
function/171.c
function/200.c
% 201-202 -- no such test