Missing cpuinfo_deinitialize implementation
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 1.2k
- Forks
- 409
- PR merge metrics
- No merged PRs in 30d
Description
When using ONNX Runtime (which has PyTorch cpuinfo as a static dependency) with a Linux program built with LeakSanitizer/AddressSanitizer, memory leaks are reported:
=================================================================
==11753==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 576 byte(s) in 1 object(s) allocated from:
#0 0x2b11dd429917 in __interceptor_calloc (/path/to/libasan.so.6+0xb4917)
#1 0x2b11e45064b6 in cpuinfo_x86_linux_init (/path/to/libonnxruntime.so.1.14.1+0x8684b6)
Direct leak of 576 byte(s) in 1 object(s) allocated from:
#0 0x2b11dd429917 in __interceptor_calloc (/path/to/libasan.so.6+0xb4917)
#1 0x2b11e4506496 in cpuinfo_x86_linux_init (/path/to/libonnxruntime.so.1.14.1+0x868496)
SUMMARY: AddressSanitizer: 1152 byte(s) leaked in 2 allocation(s).
ONNX Runtime doesn't call cpuinfo_deinitialize, but on the other hand that wouldn't help since the implementation is empty.
It would be nice if cpuinfo_deinitialize could be implemented so that ONNX Runtime and other users can call it to deallocate the resources.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in src/init.c at the cpuinfo_deinitialize implementation and trace the allocations reported from cpuinfo_x86_linux_init on Linux. Implement cleanup for those resources and verify that calling cpuinfo_deinitialize no longer produces the reported LeakSanitizer or AddressSanitizer leaks.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100