zachreizner opened issue #3018:
Feature
Add a means of getting function size from
JITModule, like how finalized data size can be retrieved.Benefit
Getting the size of a function allows for tracking memory usage of the
JITModule's generated functions. It would also make debugging the machine code output easier by knowing how big each function is so that a given disassembler knows when to stop.Implementation
Add another method to
JITModulecalledget_finalized_function_sizethat returns the size of the compiled function.Alternatives
Two alternatives would be:
- make
get_finalized_functionitself return the pointer and size, just likeget_finalized_data, which would be a breaking change- have the new
get_finalized_function_sizemethod return pointer and size, instead of simply the size
bjorn3 commented on issue #3018:
You can already get the function size through the return value of
define_function. In addition if you set thePERF_BUILDID_DIRenv var to any value and you are on linux, a file called/tmp/perf-<pid>.mapwill be written containing the address and size of every function. (This allows perf to get the function names for jitted functions)
zachreizner commented on issue #3018:
Ah, I see now that the return value of
define_functionis aModuleCompiledFunctionwith a single fieldsize. FWIW, I did try searching the API docs for something like this, but I didn't search down the route you outlined above. Thank you for quickly pointing me down the right path.
zachreizner closed issue #3018:
Feature
Add a means of getting function size from
JITModule, like how finalized data size can be retrieved.Benefit
Getting the size of a function allows for tracking memory usage of the
JITModule's generated functions. It would also make debugging the machine code output easier by knowing how big each function is so that a given disassembler knows when to stop.Implementation
Add another method to
JITModulecalledget_finalized_function_sizethat returns the size of the compiled function.Alternatives
Two alternatives would be:
- make
get_finalized_functionitself return the pointer and size, just likeget_finalized_data, which would be a breaking change- have the new
get_finalized_function_sizemethod return pointer and size, instead of simply the size
Last updated: Dec 06 2025 at 06:05 UTC