uobjnew(8)
β¨ uobjnew(8) β System Manager's Manual β¨
uobjnew, cobjnew, javaobjnew, rubyobjnew, tclobjnew β summarize object allocations in high-level languages π¦
πΈ NAME πΈ
okay so the name section is basically the family tree π§ these are all the same tool wearing different outfits, one per language: uobjnew, cobjnew, javaobjnew, rubyobjnew, and tclobjnew. they all count object allocations in high-level languages π
π SYNOPSIS π
cobjnew [-h] [-C TOP_COUNT] [-S TOP_SIZE] [-v] pid [interval]
javaobjnew [-h] [-C TOP_COUNT] [-S TOP_SIZE] [-v] pid [interval]
rubyobjnew [-h] [-C TOP_COUNT] [-S TOP_SIZE] [-v] pid [interval]
tclobjnew [-h] [-C TOP_COUNT] [-S TOP_SIZE] [-v] pid [interval]
uobjnew [-h] [-C TOP_COUNT] [-S TOP_SIZE] [-v] [-l {c,java,ruby,tcl}]
pid [interval]
π DESCRIPTION π
bestie, this one is so good π uobjnew watches object allocations in high-level languages (and yes, that includes malloc π) and then gives you a summary of the most-allocated types, ranked by how many objects there are or how many bytes they eat.
the tool leans on USDT probes that are baked into lots of high-level languages, like C, Java, Ruby, and Tcl. so your runtime has to be instrumented with those probes first π₯ sometimes that means building from source with a USDT-specific flag, like --enable-dtrace or --with-dtrace. and for Java, the process has to be launched with the -XX:+ExtendedDTraceProbes flag, or it's a no-go π
also, this uses BPF, so only the root user can run it. sorry not sorry π
π§ REQUIREMENTS π§
you'll need CONFIG_BPF and bcc π
β¨ OPTIONS β¨
-C TOP_COUNTβ show the top object types, sorted by how many instances there are π-S TOP_SIZEβ show the top object types, sorted by size instead π-vβ dump the BPF program that gets generated, for debugging π{c,java,ruby,tcl}β the language you want to trace π¦pidβ the process ID you're tracing π«Άintervalβ wait this many seconds, then print the summary and bounce. if you skip it, the tool just keeps going until you hit Ctrl+C β
π· EXAMPLES π·
trace object allocations in a Ruby process:
# uobjnew ruby 148
trace allocations from malloc and print the top 10 by total size (this one is giving main character energy π):
# uobjnew -S 10 c 1788
π FIELDS π
TYPEβ the object type being allocated. for C (malloc), this is the block size πALLOCSβ how many objects got allocated π§BYTESβ how many bytes got allocated π
π₯ OVERHEAD π₯
β οΈ okay this part is serious. object allocation events happen constantly, so this tool can add a real amount of overhead. use it with caution, and test it before you even think about running it in production π
that said, even thousands of allocations per second should give you reasonable overhead when you're debugging a problem, so it's not a total disaster π«Ά
π¦ SOURCE π¦
this comes from bcc π
π https://github.com/iovisor/bcc
also check the bcc distribution for a companion _example.txt file. it has example usage, output, and commentary for this tool, and it's honestly a vibe π
π OS π
Linux π§
π STABILITY π
unstable, still in development. so it's not fully baked yet, babe π§ͺ
π AUTHOR π
written by Sasha Goldshtein β¨
π SEE ALSO π
ustat(8), ugc(8), memleak(8) β iykyk π«Ά
the whole page is from USER COMMANDS, dated 2018-10-09, and it's the manual for uobjnew(8), sourced from bcc. go forth and count your allocations, queen πππ¦β¨
π¦ where this page comes from
- debian bookworm: bpfcc-tools 0.26.0+ds-1 Β· Apache-2.0
- debian trixie: bpfcc-tools 0.31.0+ds-7 Β· Apache-2.0
- ubuntu jammy: bpfcc-tools 0.18.0+ds-2 Β· Apache-2.0
- ubuntu noble: bpfcc-tools 0.29.1+ds-1ubuntu7 Β· Apache-2.0
- ubuntu questing: bpfcc-tools 0.31.0+ds-7ubuntu2 Β· Apache-2.0
- ubuntu resolute: bpfcc-tools 0.35.0+ds-1ubuntu2 Β· Apache-2.0
- ubuntu stonking: bpfcc-tools 0.35.0+ds-1ubuntu4 Β· Apache-2.0
- π girlified by anthropic/claude-haiku-5.5 on : a language model's rewrite of the original, under its terms