summaryrefslogtreecommitdiff
path: root/imc
diff options
context:
space:
mode:
Diffstat (limited to 'imc')
-rw-r--r--imc/checker.c31
1 files changed, 28 insertions, 3 deletions
diff --git a/imc/checker.c b/imc/checker.c
index d3f09cc..2a519ef 100644
--- a/imc/checker.c
+++ b/imc/checker.c
@@ -52,9 +52,34 @@ void check_main() {
(unsigned)(uint8_t)p->data_size);
assert(p->data[i] == (uint8_t)p->data_size);
}
- struct ll *next = p->next;
- liberate(p, p->data_size + sizeof(struct ll), &buddy);
- p = next;
+ size_t action = choose(n_size_options + 2, 0);
+ if (action == n_size_options) {
+ // do a free!
+ struct ll *next = p->next;
+ liberate(p, p->data_size + sizeof(struct ll), &buddy);
+ p = next;
+ } else if (action == n_size_options + 1) {
+ // do a free, but with reallocate
+ struct ll *next = p->next;
+ p = reallocate(p, p->data_size + sizeof(struct ll), 0, &buddy);
+ assert(!p);
+ p = next;
+ } else {
+ // do a reallocate
+ struct ll *next = p->next;
+ size_t old_size = p->data_size + sizeof(struct ll);
+ p->data_size = size_options[action];
+ size_t new_size = p->data_size + sizeof(struct ll);
+ p = reallocate(p, old_size, new_size, &buddy);
+ for (size_t i = 0; i < p->data_size; i++)
+ p->data[i] = (uint8_t)p->data_size;
+ int lifetime = choose(n_timesteps - t, 0) + 1;
+ p->next = time_to_dielist[t + lifetime];
+ time_to_dielist[t + lifetime] = p;
+ verbose("Reallocated %p, which should die at time %lu\n",
+ ll, t + lifetime);
+ p = next;
+ }
}
// try allocating a region
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback