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

Remove Valgrind/quarantine/redzone support #369

Closed
jasone opened this issue Apr 5, 2016 · 3 comments
Closed

Remove Valgrind/quarantine/redzone support #369

jasone opened this issue Apr 5, 2016 · 3 comments

Comments

Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
@jasone
Copy link
Member

@jasone jasone commented Apr 5, 2016

Rationale:

  • The arena.<i>.reset feature would at a minimum have to assure that quarantine wasn't enabled.
  • Quarantine doesn't interact well with thread caches, which means that applications which use explicit thread caches cannot in general use quarantine safely.
  • Redzone support complicates memory layout in ways that make it impossible to compute various tables at compile time (small run sizes vary, which impacts quantized run sizes). This can be mitigated, but at considerable engineering complexity cost.
@milasudril
Copy link

@milasudril milasudril commented Jun 14, 2017

What is the new way of debugging memory issues when using jemalloc?

@jasone
Copy link
Member Author

@jasone jasone commented Jun 14, 2017

@milasudril, various facilities remain, including assertions (see --enable-debug), run-time-optional junk filling (built in by default; see --disable-fill) and heap profiling (see --enable-prof). Note that jemalloc is designed primarily to be efficient (speed and memory usage), rather than to be a debugging facility. Other projects such as AddressSanitizer and Valgrind remain good (jemalloc-incompatible) options for investigating memory corruption.

@milasudril
Copy link

@milasudril milasudril commented Jun 15, 2017

The reason I use jemalloc is the presence of SSE friendlier API:s

void *mallocx(void *ptr, int flags);
void *rallocx(void *ptr, size_t size, int flags);
void dallocx(void *ptr,int flags)

In particular, the second one has no corresponding function on POSIX (there is on Windows). This means that I have do one of the following, if aligned realloc is desired:

  • Disable AVX. On 32-bit platform, also disable SSE, basically removing the need for this API.
  • Emulate rallocx by
    • posix_memalign
    • check the result
    • memcpy to the new block
    • free the old block
    • return pointer to new block
      Notice that this will always move data to a new block, even if the old block had sufficient space (this is the reason for the existence realloc).
  • Roll my own wrappers, or use the functions found in WINE/ReactOS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment