You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "mbutrovich (via GitHub)" <gi...@apache.org> on 2025/04/23 20:43:26 UTC

[PR] ignore: explore jemalloc and snmalloc instead of mimalloc [datafusion-comet]

mbutrovich opened a new pull request, #1679:
URL: https://github.com/apache/datafusion-comet/pull/1679

   ## Which issue does this PR close?
   
   <!--
   We generally require a GitHub issue to be filed for all bug fixes and enhancements and this helps us generate change logs for our releases. You can link an issue to this PR using the GitHub syntax. For example `Closes #123` indicates that this PR will close issue #123.
   -->
   
   Closes #.
   
   ## Rationale for this change
   
   <!--
    Why are you proposing this change? If this is already explained clearly in the issue then this section is not needed.
    Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes.  
   -->
   Comet currently supports mimalloc as its memory allocate (`make release COMET_FEATURES=mimalloc` or `cargo build --features=mimalloc`). Based on discussion [here](https://github.com/apache/datafusion-comet/issues/1648#issuecomment-2819483674), we want to explore jemalloc and snmalloc as alternatives to mimalloc for our custom allocator. 
   
   ## What changes are included in this PR?
   
   <!--
   There is no need to duplicate the description in the issue here but it is sometimes worth providing a summary of the individual changes in this PR.
   -->
   
   Add jemalloc and snmalloc as features. I had tcmalloc as well, but it failed to link at compilation time so I took it back out.
   
   ## How are these changes tested?
   
   <!--
   We typically require tests for all PRs in order to:
   1. Prevent the code from being accidentally broken by subsequent changes
   2. Serve as another way to document the expected behavior of the code
   
   If tests are not included in your PR, please explain why (for example, are they covered by existing tests)?
   -->
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] feat: add jemalloc as optional custom allocator [datafusion-comet]

Posted by "mbutrovich (via GitHub)" <gi...@apache.org>.
mbutrovich commented on code in PR #1679:
URL: https://github.com/apache/datafusion-comet/pull/1679#discussion_r2058898316


##########
native/core/src/lib.rs:
##########
@@ -50,6 +54,10 @@ pub mod execution;
 mod jvm_bridge;
 pub mod parquet;
 
+#[cfg(all(not(target_env = "msvc"), feature = "jemalloc"))]

Review Comment:
   I had code to do this, but the compiler yelled at me first that you can't enable two allocators at the same time, so we're good there.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] feat: add jemalloc as optional custom allocator [datafusion-comet]

Posted by "mbutrovich (via GitHub)" <gi...@apache.org>.
mbutrovich commented on code in PR #1679:
URL: https://github.com/apache/datafusion-comet/pull/1679#discussion_r2058901724


##########
native/core/src/lib.rs:
##########
@@ -50,6 +54,10 @@ pub mod execution;
 mod jvm_bridge;
 pub mod parquet;
 
+#[cfg(all(not(target_env = "msvc"), feature = "jemalloc"))]

Review Comment:
   ```
   cd native && RUSTFLAGS=" -Ctarget-cpu=native" cargo build --release --features=jemalloc,mimalloc
      Compiling libmimalloc-sys v0.1.42
      Compiling mimalloc v0.1.46
      Compiling datafusion-comet v0.8.0 (/Users/matt/git/datafusion-comet/native/core)
   error[E0428]: the name `GLOBAL` is defined multiple times
     --> core/src/lib.rs:63:1
      |
   59 | static GLOBAL: Jemalloc = Jemalloc;
      | ----------------------------------- previous definition of the value `GLOBAL` here
   ...
   63 | static GLOBAL: MiMalloc = MiMalloc;
      | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `GLOBAL` redefined here
      |
      = note: `GLOBAL` must be defined only once in the value namespace of this module
   
   error: cannot define multiple global allocators
     --> core/src/lib.rs:63:1
      |
   59 | static GLOBAL: Jemalloc = Jemalloc;
      | ----------------------------------- previous global allocator defined here
   ...
   62 | #[global_allocator]
      | ------------------- in this procedural macro expansion
   63 | static GLOBAL: MiMalloc = MiMalloc;
      | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot define a new global allocator
      |
      = note: this error originates in the attribute macro `global_allocator` (in Nightly builds, run with -Z macro-backtrace for more info)
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] feat: add jemalloc as optional custom allocator [datafusion-comet]

Posted by "mbutrovich (via GitHub)" <gi...@apache.org>.
mbutrovich commented on PR #1679:
URL: https://github.com/apache/datafusion-comet/pull/1679#issuecomment-2827971141

   The Spark SQL test does not seem related to the change.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] feat: add jemalloc as optional custom allocator [datafusion-comet]

Posted by "mbutrovich (via GitHub)" <gi...@apache.org>.
mbutrovich commented on code in PR #1679:
URL: https://github.com/apache/datafusion-comet/pull/1679#discussion_r2058898316


##########
native/core/src/lib.rs:
##########
@@ -50,6 +54,10 @@ pub mod execution;
 mod jvm_bridge;
 pub mod parquet;
 
+#[cfg(all(not(target_env = "msvc"), feature = "jemalloc"))]

Review Comment:
   I had code to do this, but the compiler yelled at me first than you can't enable two allocators at the same time, so we're good there.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] feat: add jemalloc as optional custom allocator [datafusion-comet]

Posted by "parthchandra (via GitHub)" <gi...@apache.org>.
parthchandra commented on PR #1679:
URL: https://github.com/apache/datafusion-comet/pull/1679#issuecomment-2828241291

   Restarted the test


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] feat: add jemalloc as optional custom allocator [datafusion-comet]

Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #1679:
URL: https://github.com/apache/datafusion-comet/pull/1679#issuecomment-2827961029

   ## [Codecov](https://app.codecov.io/gh/apache/datafusion-comet/pull/1679?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   All modified and coverable lines are covered by tests :white_check_mark:
   > Project coverage is 57.44%. Comparing base [(`f09f8af`)](https://app.codecov.io/gh/apache/datafusion-comet/commit/f09f8af64c6599255e116a376f4f008f2fd63b43?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) to head [(`f69ea22`)](https://app.codecov.io/gh/apache/datafusion-comet/commit/f69ea22998a2483ee616775ba82f9a45566bef80?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   > Report is 161 commits behind head on main.
   
   <details><summary>Additional details and impacted files</summary>
   
   
   ```diff
   @@             Coverage Diff              @@
   ##               main    #1679      +/-   ##
   ============================================
   + Coverage     56.12%   57.44%   +1.32%     
   - Complexity      976     1021      +45     
   ============================================
     Files           119      125       +6     
     Lines         11743    12512     +769     
     Branches       2251     2354     +103     
   ============================================
   + Hits           6591     7188     +597     
   - Misses         4012     4136     +124     
   - Partials       1140     1188      +48     
   ```
   
   </details>
   
   [:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/apache/datafusion-comet/pull/1679?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).   
   :loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   
   <details><summary> :rocket: New features to boost your workflow: </summary>
   
   - :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
   </details>


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] feat: add jemalloc as optional custom allocator [datafusion-comet]

Posted by "parthchandra (via GitHub)" <gi...@apache.org>.
parthchandra commented on code in PR #1679:
URL: https://github.com/apache/datafusion-comet/pull/1679#discussion_r2058887934


##########
native/core/src/lib.rs:
##########
@@ -50,6 +54,10 @@ pub mod execution;
 mod jvm_bridge;
 pub mod parquet;
 
+#[cfg(all(not(target_env = "msvc"), feature = "jemalloc"))]

Review Comment:
   Should we have a check to make sure both jemalloc and mimalloc cannot be enabled at the same time?
   ```
   #[cfg(all(feature = "jemalloc", feature = "mimalloc"))]
   compile_error!("feature \"jemalloc\" and feature \"mimalloc\" cannot be enabled at the same time");
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] feat: add jemalloc as optional custom allocator [datafusion-comet]

Posted by "andygrove (via GitHub)" <gi...@apache.org>.
andygrove merged PR #1679:
URL: https://github.com/apache/datafusion-comet/pull/1679


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org