-
Notifications
You must be signed in to change notification settings - Fork 4.2k
GH-50083: [C++] Access mimalloc through dynamically-resolved symbols #41128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,6 +17,7 @@ | |
|
|
||
| #include "arrow/memory_pool.h" | ||
| #include "arrow/result.h" | ||
| #include "arrow/util/config.h" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why this change?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because I noticed only the system memory pool benchmarks were enabled otherwise, as
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh... good finding!
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shall we then statically assert the persence of
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The problem is that It might have been better to use |
||
| #include "arrow/util/logging.h" | ||
|
|
||
| #include "benchmark/benchmark.h" | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| // Licensed to the Apache Software Foundation (ASF) under one | ||
| // or more contributor license agreements. See the NOTICE file | ||
| // distributed with this work for additional information | ||
| // regarding copyright ownership. The ASF licenses this file | ||
| // to you under the Apache License, Version 2.0 (the | ||
| // "License"); you may not use this file except in compliance | ||
| // with the License. You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, | ||
| // software distributed under the License is distributed on an | ||
| // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| // KIND, either express or implied. See the License for the | ||
| // specific language governing permissions and limitations | ||
| // under the License. | ||
|
|
||
| #include "arrow/memory_pool_internal.h" | ||
| #include "arrow/util/io_util.h" | ||
| #include "arrow/util/logging.h" // IWYU pragma: keep | ||
|
|
||
| #include <mimalloc.h> | ||
|
|
||
| // extern "C" { | ||
|
|
||
| void arrow_mi_free(void* p) { mi_free(p); } | ||
|
|
||
| void* arrow_mi_malloc_aligned(size_t size, size_t alignment) { | ||
| return mi_malloc_aligned(size, alignment); | ||
| } | ||
|
|
||
| void* arrow_mi_realloc_aligned(void* p, size_t new_size, size_t alignment) { | ||
| return mi_realloc_aligned(p, new_size, alignment); | ||
| } | ||
|
|
||
| void arrow_mi_collect(bool force) { mi_collect(force); } | ||
|
|
||
| // } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -106,6 +106,14 @@ class TestMemoryPoolBase : public ::testing::Test { | |
| pool->Free(data512, 10, 512); | ||
| } | ||
| } | ||
|
|
||
| void TestReleaseUnused() { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this test really helping on the code changed in this PR?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's exercising the interposition for |
||
| auto pool = memory_pool(); | ||
| const int64_t nbytes = pool->bytes_allocated(); | ||
| pool->ReleaseUnused(); | ||
| // Unfortunately there's not much that we can assert here | ||
| ASSERT_EQ(nbytes, pool->bytes_allocated()); | ||
| } | ||
| }; | ||
|
|
||
| } // namespace arrow | ||
Uh oh!
There was an error while loading. Please reload this page.