Skip to content

Link jemalloc pool and test with libc explicitly to avoid recursive calls to jemalloc (tmp fix) #139

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

Merged
merged 1 commit into from
Jan 19, 2024

Conversation

igchor
Copy link
Member

@igchor igchor commented Jan 13, 2024

This forces the linker to link with libc before linking with jemalloc. Because of that, jemalloc will not override symbols for malloc/free.

Without this patch, we would call malloc from within the arena_extent_alloc (jemalloc hook) that would be intercepted by jemalloc.

This fixes the issue with debug jemalloc when running tests with tracking enabled:

<jemalloc>: Should own 0 locks of rank >= 14: extent_grow(17)
Aborted (core dumped)

@igchor igchor changed the title Link jemalloc pool and test with libc explicitly to avoid recursive calls to jemalloc. TMP fix: Link jemalloc pool and test with libc explicitly to avoid recursive calls to jemalloc. Jan 13, 2024
@bratpiorka
Copy link
Contributor

Interesting, I thought in this case the linking would fail because of multiple definitions of the same symbols. Anyway - you added a TODO in the code - what would be the final solution?

@vinser52
Copy link
Contributor

I would extend TODO you added with the detailed explanations like you posted for this PR:

This forces the linker to link with libc before linking with jemalloc. Because of that, jemalloc will not override symbols for malloc/free.

Without this patch, we would call malloc from within the arena_extent_alloc (jemalloc hook) that would be intercepted by jemalloc.

This fixes the issue with debug jemalloc when running tests with tracking enabled:

: Should own 0 locks of rank >= 14: extent_grow(17)
Aborted (core dumped)

Copy link
Contributor

@ldorau ldorau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@igchor Please add a detailed comment to the code like @vinser52 suggested above

This forces the linker to link with libc before linking with jemalloc.
Because of that, jemalloc will not override symbols for malloc/free.
@igchor igchor changed the title TMP fix: Link jemalloc pool and test with libc explicitly to avoid recursive calls to jemalloc. Link jemalloc pool and test with libc explicitly to avoid recursive calls to jemalloc (tmp fix) Jan 18, 2024
@igchor igchor marked this pull request as ready for review January 18, 2024 18:17
@igchor igchor requested a review from a team as a code owner January 18, 2024 18:17
@igchor
Copy link
Member Author

igchor commented Jan 18, 2024

@igchor Please add a detailed comment to the code like @vinser52 suggested above

Done. I've created an issue and added link to that issue in the comments.

@bratpiorka bratpiorka merged commit 09e5b81 into oneapi-src:main Jan 19, 2024
@igchor igchor deleted the glibc_malloc branch January 19, 2024 19:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants