From f402f22522ea53dedaa7d9d26d71a4fb579aad50 Mon Sep 17 00:00:00 2001 From: Pekka Pirinen Date: Fri, 9 Mar 2001 18:32:42 +0000 Subject: [PATCH] Convert to chains Copied from Perforce Change: 21697 ServerID: perforce.ravenbrook.com --- mps/qa/function/81.c | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/mps/qa/function/81.c b/mps/qa/function/81.c index 01557073658..93d2e975870 100644 --- a/mps/qa/function/81.c +++ b/mps/qa/function/81.c @@ -1,6 +1,6 @@ /* TEST_HEADER - id = $HopeName: MMQA_test_function!81.c(trunk.3) $ + id = $HopeName: MMQA_test_function!81.c(trunk.4) $ summary = run out of memory while collecting language = c link = testlib.o fastfmt.o @@ -13,6 +13,12 @@ END_HEADER #include "rankfmt.h" +#define genCOUNT (3) + +static mps_gen_param_s testChain[genCOUNT] = { + { 6000, 0.90 }, { 8000, 0.65 }, { 16000, 0.50 } }; + + void *stackpointer; @@ -24,6 +30,7 @@ static void test(void) mps_root_t root, root1; mps_fmt_t format; + mps_chain_t chain; mps_ap_t ap; mycell *a, *b; @@ -31,7 +38,6 @@ static void test(void) int j; /* create an arena that can't grow beyond 15 Mb */ - cdie(mps_arena_create(&arena, mps_arena_class_vm(), (size_t)(1024*1024*15)), "create arena"); @@ -47,9 +53,10 @@ static void test(void) cdie(mps_fmt_create_A(&format, arena, &fmtA), "create format"); + cdie(mps_chain_create(&chain, arena, genCOUNT, testChain), "chain_create"); - cdie(mps_pool_create(&pool, arena, mps_class_amc(), format), - "create pool"); + die(mmqa_pool_create_chain(&pool, arena, mps_class_amc(), format, chain), + "create pool"); cdie(mps_ap_create(&ap, pool, MPS_RANK_EXACT), "create ap"); @@ -58,8 +65,7 @@ static void test(void) /* allocate at least 100 * 10K = 10M */ - for (j=0; j<100; j++) - { + for (j = 0; j < 100; j++) { comment("%i of 100.", j); a = allocone(ap, 2, MPS_RANK_EXACT); setref(a, 0, b); @@ -73,21 +79,12 @@ static void test(void) mps_arena_collect(arena); mps_ap_destroy(ap); - comment("Destroyed ap."); - mps_pool_destroy(pool); - comment("Destroyed pool."); - + mps_chain_destroy(chain); mps_fmt_destroy(format); - comment("Destroyed format."); - mps_root_destroy(root); mps_root_destroy(root1); - comment("Destroyed roots."); - mps_thread_dereg(thread); - comment("Deregistered thread."); - mps_arena_destroy(arena); comment("Destroyed arena."); }