DMD currently uses a very hacky form of "sampling" by default to avoid
recording stack traces for all blocks. This makes DMD run faster than when it
records all stack traces.
This patch changes the sampling method used; in fact, it avoids "sampling" at
all. The existence of all heap blocks is now recorded exactly, but by default
we only record an allocation stack for each heap block if a Bernoulli trial
succeeds. This choice works well because getting the stack trace is ~100x
slower than recording the block's existence.
Overall, this approach is simpler and it also gives better output -- the choice
of which blocks to record allocation stacks for is mathematically sound, no
stack trace gets blamed for allocations it didn't do, and block counts and
sizes are now always exact.
Other specific things changed.
- All notion of sampling is removed from the various data structures.
- The --sample-below option is removed in favour of --stacks={partial,full}.
- The format of the JSON output file has changed.
- The names of various test files have changed to reflect concept changes.
27 lines
651 B
Plaintext
27 lines
651 B
Plaintext
#-----------------------------------------------------------------
|
|
# dmd.py --filter-stacks-for-testing -o script-max-frames-1-actual.txt --max-frames=1 script-max-frames.json
|
|
|
|
Invocation {
|
|
$DMD = '--mode=live --stacks=full'
|
|
Mode = 'live'
|
|
}
|
|
|
|
#-----------------------------------------------------------------
|
|
|
|
Live {
|
|
4 blocks in heap block record 1 of 1
|
|
4,416 bytes (4,404 requested / 12 slop)
|
|
Individual block sizes: 4,096; 128; 112; 80
|
|
100.00% of the heap (100.00% cumulative)
|
|
Allocated at {
|
|
#01: E (E.cpp:99)
|
|
}
|
|
}
|
|
|
|
#-----------------------------------------------------------------
|
|
|
|
Summary {
|
|
Total: 4,416 bytes in 4 blocks
|
|
}
|
|
|