[
https://issues.apache.org/jira/browse/ARROW-2210?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16378792#comment-16378792
]
ASF GitHub Bot commented on ARROW-2210:
---------------------------------------
wesm closed pull request #1672: ARROW-2210: [C++] Reset ptr on failed memory
allocation
URL: https://github.com/apache/arrow/pull/1672
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git a/cpp/src/arrow/memory_pool.cc b/cpp/src/arrow/memory_pool.cc
index b8cd9c2fc..dedab7ea7 100644
--- a/cpp/src/arrow/memory_pool.cc
+++ b/cpp/src/arrow/memory_pool.cc
@@ -107,10 +107,12 @@ class DefaultMemoryPool : public MemoryPool {
Status Reallocate(int64_t old_size, int64_t new_size, uint8_t** ptr)
override {
#ifdef ARROW_JEMALLOC
+ uint8_t* previous_ptr = *ptr;
*ptr = reinterpret_cast<uint8_t*>(rallocx(*ptr, new_size,
MALLOCX_ALIGN(kAlignment)));
if (*ptr == NULL) {
std::stringstream ss;
ss << "realloc of size " << new_size << " failed";
+ *ptr = previous_ptr;
return Status::OutOfMemory(ss.str());
}
#else
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
> [C++] TestBuffer_ResizeOOM has a memory leak with jemalloc
> ----------------------------------------------------------
>
> Key: ARROW-2210
> URL: https://issues.apache.org/jira/browse/ARROW-2210
> Project: Apache Arrow
> Issue Type: Bug
> Components: C++
> Reporter: Uwe L. Korn
> Assignee: Uwe L. Korn
> Priority: Major
> Labels: pull-request-available
> Fix For: 0.9.0
>
>
> Current travis failure:
> {code:java}
> 5: ==21958== 128 bytes in 1 blocks are definitely lost in loss record 1 of 2
> 5: ==21958== at 0x6228F9: je_arrow_mallocx (jemalloc.c:2292)
> 5: ==21958== by 0x5AA05E: arrow::(anonymous
> namespace)::AllocateAligned(long, unsigned char**) (memory_pool.cc:58)
> 5: ==21958== by 0x5AA7CF: arrow::DefaultMemoryPool::Allocate(long,
> unsigned char**) (memory_pool.cc:96)
> 5: ==21958== by 0x5A04F1: arrow::PoolBuffer::Reserve(long) (buffer.cc:93)
> 5: ==21958== by 0x5A07E3: arrow::PoolBuffer::Resize(long, bool)
> (buffer.cc:104)
> 5: ==21958== by 0x571417: arrow::TestBuffer_ResizeOOM_Test::TestBody()
> (buffer-test.cc:119)
> 5: ==21958== by 0x60FE27: void
> testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test,
> void>(testing::Test*, void (testing::Test::*)(), char const*) (gtest.cc:2402)
> 5: ==21958== by 0x609E29: void
> testing::internal::HandleExceptionsInMethodIfSupported<testing::Test,
> void>(testing::Test*, void (testing::Test::*)(), char const*) (gtest.cc:2438)
> 5: ==21958== by 0x5EF880: testing::Test::Run() (gtest.cc:2475)
> 5: ==21958== by 0x5F0127: testing::TestInfo::Run() (gtest.cc:2656)
> 5: ==21958== by 0x5F07EB: testing::TestCase::Run() (gtest.cc:2774)
> 5: ==21958== by 0x5F71BB: testing::internal::UnitTestImpl::RunAllTests()
> (gtest.cc:4649){code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)