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

update functions are broken #159

Open
umanwizard opened this issue Aug 14, 2020 · 0 comments
Open

update functions are broken #159

umanwizard opened this issue Aug 14, 2020 · 0 comments

Comments

@umanwizard
Copy link

The same pointer is used for oldp and newp:

pub unsafe fn update<T>(name: &[u8], mut value: T) -> Result<T> {
    validate_name(name);

    let mut len = mem::size_of::<T>();
    cvt(jemalloc_sys::mallctl(
        name as *const _ as *const c_char,
        &mut value as *mut _ as *mut _,
        &mut len,
        &mut value as *mut _ as *mut _,
        len,
    ))?;
    assert_eq!(len, mem::size_of::<T>());
    Ok(value)
}

This is not supported by jemalloc, and as a result, the update function does not actually work in many cases. For example, jemalloc_ctl::background_thread.update(true).unwrap() does not actually turn on background threads.

The out pointer oldp and the new value passed in newp must be different pointers.

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

No branches or pull requests

1 participant