Skip to content

Commit

Permalink
tools/memleak: Fixes explanations for -Z and -z options
Browse files Browse the repository at this point in the history
These are the description of each options written in memleak.c file
-z option: capture only allocations larger than this size
-Z option: capture only allocations smaller than this size

But actually they work like this
-z option: capture only allocations larger than or equal to this size
-Z option: capture only allocations smaller than or equal to this size

Which means, there was off-by-one errors.
So, fixes the explanation message.
  • Loading branch information
Bojun-Seo committed Nov 25, 2024
1 parent bccb275 commit cc868dc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions tools/memleak.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@ def run_command_get_pid(command):
parser.add_argument("-T", "--top", type=int, default=10,
help="display only this many top allocating stacks (by size)")
parser.add_argument("-z", "--min-size", type=int,
help="capture only allocations larger than this size")
help="capture only allocations larger than or equal to this size")
parser.add_argument("-Z", "--max-size", type=int,
help="capture only allocations smaller than this size")
help="capture only allocations smaller than or equal to this size")
parser.add_argument("-O", "--obj", type=str, default="c",
help="attach to allocator functions in the specified object")
parser.add_argument("--ebpf", action="store_true",
Expand Down
4 changes: 2 additions & 2 deletions tools/memleak_example.txt
Original file line number Diff line number Diff line change
Expand Up @@ -217,9 +217,9 @@ optional arguments:
sample every N-th allocation to decrease the overhead
-T TOP, --top TOP display only this many top allocating stacks (by size)
-z MIN_SIZE, --min-size MIN_SIZE
capture only allocations larger than this size
capture only allocations larger than or equal to this size
-Z MAX_SIZE, --max-size MAX_SIZE
capture only allocations smaller than this size
capture only allocations smaller than or equal to this size
-O OBJ, --obj OBJ attach to allocator functions in the specified object
--sort KEY report sorted in given key; available key list: size,
count
Expand Down

0 comments on commit cc868dc

Please sign in to comment.