erasure-code: use new/delete to alloc/free coefficients array#56586
Merged
erasure-code: use new/delete to alloc/free coefficients array#56586
Conversation
Contributor
Author
|
pushed to https://shaman.ceph.com/builds/ceph/wip-pr-56586-kefu/22e9098308a4561faf7db77e1adaa49d25d780fa/, to build test it. but would be ideal if we can run it through teuthology tests. |
before this change, we allocate coefficients table with
`malloc()` in `ErasureCodeIsaDefault::prepare()`, but free them using
`delete`. this is identified by LeakSanitizer, and it reports
```
==3135332==ERROR: AddressSanitizer: alloc-dealloc-mismatch (malloc vs operator delete) on 0x60700002a870
#0 0x5627c6ef721d in operator delete(void*) (/home/jenkins-build/build/workspace/ceph-pull-requests/build/bin/unittest_erasure_code_plugin_isa+0x1ca21d) (BuildId: 7922906370e5183d67f55211a868c0b0e22b4a2c)
#1 0x7fbbe38e858f in ErasureCodeIsaTableCache::~ErasureCodeIsaTableCache() /home/jenkins-build/build/workspace/ceph-pull-requests/src/erasure-code/isa/ErasureCodeIsaTableCache.cc:65:13
#2 0x7fbbe390be40 in ErasureCodePluginIsa::~ErasureCodePluginIsa() /home/jenkins-build/build/workspace/ceph-pull-requests/src/erasure-code/isa/ErasureCodePluginIsa.h:24:7
#3 0x7fbbe390be68 in ErasureCodePluginIsa::~ErasureCodePluginIsa() /home/jenkins-build/build/workspace/ceph-pull-requests/src/erasure-code/isa/ErasureCodePluginIsa.h:24:7
#4 0x5627c7063b52 in ceph::ErasureCodePluginRegistry::~ErasureCodePluginRegistry() /home/jenkins-build/build/workspace/ceph-pull-requests/src/erasure-code/ErasureCodePlugin.cc:49:5
#5 0x7fbbeccb6494 in __run_exit_handlers stdlib/./stdlib/exit.c:113:8
#6 0x7fbbeccb660f in exit stdlib/./stdlib/exit.c:143:3
#7 0x7fbbecc9ad96 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:74:3
#8 0x7fbbecc9ae3f in __libc_start_main csu/../csu/libc-start.c:392:3
#9 0x5627c6e38da4 in _start (/home/jenkins-build/build/workspace/ceph-pull-requests/build/bin/unittest_erasure_code_plugin_isa+0x10bda4) (BuildId: 7922906370e5183d67f55211a868c0b0e22b4a2c)
```
so, in this change, we use `new []` and `delete []` to allocate and free
them, to be more consistent, and to silence this warning.
Signed-off-by: Kefu Chai <tchaikov@gmail.com>
22e9098 to
6a88e09
Compare
Contributor
Author
|
changelog
|
Contributor
Author
|
being tested at #56537 |
14 tasks
Contributor
|
This PR is under test in https://tracker.ceph.com/issues/65560. |
Svelar
previously requested changes
Apr 18, 2024
Nothing is related with this changes. Would file another PR.
Contributor
Author
@Svelar thanks! |
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
before this change, we allocate coefficients table with
malloc()inErasureCodeIsaDefault::prepare(), but free them usingdelete. this is identified by LeakSanitizer, and it reportsso, in this change, we use
new []anddelete []to allocate and free them, to be more consistent, and to silence this warning.Contribution Guidelines
To sign and title your commits, please refer to Submitting Patches to Ceph.
If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.
When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an
xbetween the brackets:[x]. Spaces and capitalization matter when checking off items this way.Checklist
Show available Jenkins commands
jenkins retest this pleasejenkins test classic perfjenkins test crimson perfjenkins test signedjenkins test make checkjenkins test make check arm64jenkins test submodulesjenkins test dashboardjenkins test dashboard cephadmjenkins test apijenkins test docsjenkins render docsjenkins test ceph-volume alljenkins test ceph-volume toxjenkins test windowsjenkins test rook e2e