- > generations[g].max_blocks
- && stp->is_compacted == 0)) {
- needed += 2 * stp->n_blocks + stp->n_large_blocks;
- } else {
- needed += stp->n_blocks + stp->n_large_blocks;
+ > generations[g].max_blocks)) {
+ // we will collect this gen next time
+ if (stp->mark) {
+ // bitmap:
+ needed += stp->n_blocks / BITS_IN(W_);
+ // mark stack:
+ needed += stp->n_blocks / 100;
+ }
+ if (stp->compact) {
+ continue; // no additional space needed for compaction
+ } else {
+ needed += stp->n_blocks;
+ }