Skip to content
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

[C++] jemalloc prepocessor definitions causes unity builds to mix jemalloc and system allocator functions #34206

Closed
felipecrv opened this issue Feb 15, 2023 · 1 comment · Fixed by #34185
Assignees
Milestone

Comments

@felipecrv
Copy link
Contributor

felipecrv commented Feb 15, 2023

Since jemalloc.h does

#  define malloc je_malloc

when JEMALLOC_MANGLE is defined, we can get this error in CI during an unity build

/arrow/cpp/src/arrow/vendored/ProducerConsumerQueue.h: In constructor 'arrow_vendored::folly::ProducerConsumerQueue<T>::ProducerConsumerQueue(uint32_t)':

/arrow/cpp/src/arrow/vendored/ProducerConsumerQueue.h:82:39: error: 'je_arrow_malloc' is not a member of 'std'; did you mean 'je_arrow_malloc'?

   82 |         records_(static_cast<T*>(std::malloc(sizeof(T) * size))),

      |                                       ^~~~~~

jemalloc_ep-prefix/src/jemalloc_ep/dist/include/jemalloc/jemalloc.h:254:32: note: 'je_arrow_malloc' declared here

  254 |     void JEMALLOC_SYS_NOTHROW *je_malloc(size_t size)

      |                                ^~~~~~~~~

/arrow/cpp/src/arrow/vendored/ProducerConsumerQueue.h: In destructor 'arrow_vendored::folly::ProducerConsumerQueue<T>::~ProducerConsumerQueue()':

/arrow/cpp/src/arrow/vendored/ProducerConsumerQueue.h:106:10: error: 'je_arrow_free' is not a member of 'std'; did you mean 'je_arrow_free'?

  106 |     std::free(records_);

      |          ^~~~

jemalloc_ep-prefix/src/jemalloc_ep/dist/include/jemalloc/jemalloc.h:269:43: note: 'je_arrow_free' declared here

  269 | JEMALLOC_EXPORT void JEMALLOC_SYS_NOTHROW je_free(void *ptr)

      |                                           ^~~~~~~

Component(s)

C++

@felipecrv
Copy link
Contributor Author

take

@lidavidm lidavidm changed the title jemalloc prepocessor definitions causes unity builds to mix jemalloc and system allocator functions [C++] jemalloc prepocessor definitions causes unity builds to mix jemalloc and system allocator functions Feb 15, 2023
@kou kou added this to the 12.0.0 milestone Feb 16, 2023
kou pushed a commit that referenced this issue Feb 16, 2023
Since `jemalloc.h` does

    #  define malloc je_malloc

when `JEMALLOC_MANGLE` is defined, we can get this error in CI during an
unity build

    /arrow/cpp/src/arrow/vendored/ProducerConsumerQueue.h: In constructor 'arrow_vendored::folly::ProducerConsumerQueue<T>::ProducerConsumerQueue(uint32_t)':

    /arrow/cpp/src/arrow/vendored/ProducerConsumerQueue.h:82:39: error: 'je_arrow_malloc' is not a member of 'std'; did you mean 'je_arrow_malloc'?

       82 |         records_(static_cast<T*>(std::malloc(sizeof(T) * size))),

          |                                       ^~~~~~

    jemalloc_ep-prefix/src/jemalloc_ep/dist/include/jemalloc/jemalloc.h:254:32: note: 'je_arrow_malloc' declared here

      254 |     void JEMALLOC_SYS_NOTHROW *je_malloc(size_t size)

          |                                ^~~~~~~~~

    /arrow/cpp/src/arrow/vendored/ProducerConsumerQueue.h: In destructor 'arrow_vendored::folly::ProducerConsumerQueue<T>::~ProducerConsumerQueue()':

    /arrow/cpp/src/arrow/vendored/ProducerConsumerQueue.h:106:10: error: 'je_arrow_free' is not a member of 'std'; did you mean 'je_arrow_free'?

      106 |     std::free(records_);

          |          ^~~~

    jemalloc_ep-prefix/src/jemalloc_ep/dist/include/jemalloc/jemalloc.h:269:43: note: 'je_arrow_free' declared here

      269 | JEMALLOC_EXPORT void JEMALLOC_SYS_NOTHROW je_free(void *ptr)

          |                                           ^~~~~~~

* Closes: #34206

Authored-by: Felipe Oliveira Carvalho <felipekde@gmail.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
gringasalpastor pushed a commit to gringasalpastor/arrow that referenced this issue Feb 17, 2023
…pache#34185)

Since `jemalloc.h` does

    #  define malloc je_malloc

when `JEMALLOC_MANGLE` is defined, we can get this error in CI during an
unity build

    /arrow/cpp/src/arrow/vendored/ProducerConsumerQueue.h: In constructor 'arrow_vendored::folly::ProducerConsumerQueue<T>::ProducerConsumerQueue(uint32_t)':

    /arrow/cpp/src/arrow/vendored/ProducerConsumerQueue.h:82:39: error: 'je_arrow_malloc' is not a member of 'std'; did you mean 'je_arrow_malloc'?

       82 |         records_(static_cast<T*>(std::malloc(sizeof(T) * size))),

          |                                       ^~~~~~

    jemalloc_ep-prefix/src/jemalloc_ep/dist/include/jemalloc/jemalloc.h:254:32: note: 'je_arrow_malloc' declared here

      254 |     void JEMALLOC_SYS_NOTHROW *je_malloc(size_t size)

          |                                ^~~~~~~~~

    /arrow/cpp/src/arrow/vendored/ProducerConsumerQueue.h: In destructor 'arrow_vendored::folly::ProducerConsumerQueue<T>::~ProducerConsumerQueue()':

    /arrow/cpp/src/arrow/vendored/ProducerConsumerQueue.h:106:10: error: 'je_arrow_free' is not a member of 'std'; did you mean 'je_arrow_free'?

      106 |     std::free(records_);

          |          ^~~~

    jemalloc_ep-prefix/src/jemalloc_ep/dist/include/jemalloc/jemalloc.h:269:43: note: 'je_arrow_free' declared here

      269 | JEMALLOC_EXPORT void JEMALLOC_SYS_NOTHROW je_free(void *ptr)

          |                                           ^~~~~~~

* Closes: apache#34206

Authored-by: Felipe Oliveira Carvalho <felipekde@gmail.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
fatemehp pushed a commit to fatemehp/arrow that referenced this issue Feb 24, 2023
…pache#34185)

Since `jemalloc.h` does

    #  define malloc je_malloc

when `JEMALLOC_MANGLE` is defined, we can get this error in CI during an
unity build

    /arrow/cpp/src/arrow/vendored/ProducerConsumerQueue.h: In constructor 'arrow_vendored::folly::ProducerConsumerQueue<T>::ProducerConsumerQueue(uint32_t)':

    /arrow/cpp/src/arrow/vendored/ProducerConsumerQueue.h:82:39: error: 'je_arrow_malloc' is not a member of 'std'; did you mean 'je_arrow_malloc'?

       82 |         records_(static_cast<T*>(std::malloc(sizeof(T) * size))),

          |                                       ^~~~~~

    jemalloc_ep-prefix/src/jemalloc_ep/dist/include/jemalloc/jemalloc.h:254:32: note: 'je_arrow_malloc' declared here

      254 |     void JEMALLOC_SYS_NOTHROW *je_malloc(size_t size)

          |                                ^~~~~~~~~

    /arrow/cpp/src/arrow/vendored/ProducerConsumerQueue.h: In destructor 'arrow_vendored::folly::ProducerConsumerQueue<T>::~ProducerConsumerQueue()':

    /arrow/cpp/src/arrow/vendored/ProducerConsumerQueue.h:106:10: error: 'je_arrow_free' is not a member of 'std'; did you mean 'je_arrow_free'?

      106 |     std::free(records_);

          |          ^~~~

    jemalloc_ep-prefix/src/jemalloc_ep/dist/include/jemalloc/jemalloc.h:269:43: note: 'je_arrow_free' declared here

      269 | JEMALLOC_EXPORT void JEMALLOC_SYS_NOTHROW je_free(void *ptr)

          |                                           ^~~~~~~

* Closes: apache#34206

Authored-by: Felipe Oliveira Carvalho <felipekde@gmail.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants