jemallocator icon indicating copy to clipboard operation
jemallocator copied to clipboard

Support `prof.dump` for jemalloc-ctl.

Open yuhao-su opened this issue 2 years ago • 2 comments

I'm trying to implement prof.dump for jemalloc but I met some problems that can be generally applied to all functions that take a string argument.

The write interface usually take a &'static str as an input argument, however, the raw::write_str take a C-style string the end with \0. I can think of two solutions:

  1. Take ffi::CStr as input. Let users pass a C-style string.
  2. include alloc in jemalloc-ctl and convert a Rust-style "`&'static str" to a C-stype string.

Could you let me what is the best practice for this? Thanks!

yuhao-su avatar Jul 20 '23 10:07 yuhao-su

CStr should be used.

BusyJay avatar Jul 21 '23 03:07 BusyJay

Okay, I'll submit a pr later

yuhao-su avatar Jul 21 '23 04:07 yuhao-su