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

Suggestion: Why are there only C++ interface in malloc_hook.h and malloc_extension.h ? #66

Closed
alk opened this issue Aug 22, 2015 · 2 comments

Comments

@alk
Copy link
Contributor

alk commented Aug 22, 2015

Originally reported on Google Code with ID 63

  There are great C-compatible interfaces in heap-profiler.h and
profiler.h. But why are there only C++ interface in malloc_hook.h and
malloc_extension.h ?

Reported by lxu4net on 2008-06-24 12:29:39

@alk
Copy link
Contributor Author

alk commented Aug 22, 2015

It's a fair question.  The C-compatible interfaces were added to heap-profiler.h and
profiler.h more or less at the last minute, when we realized it was easy to do so.

Originally, we had developed tcmalloc as a c++-only application.  You still see the
legacy of that in malloc_hook and malloc_extension, which were designed to use the
capabilities of C++, and weren't easy to make a "C" interface for like the cpu
profiler and heap profiler (with their much simpler APIs).

With a recent refactoring of the malloc_hook code, it's actually pretty easy to make
that "C"-accessible; I'll see if I can do that for the next release. 
malloc_extension.h is much more difficult -- it uses virtual inheritence to support
multiple memory allocators.  But I may be able to do something there as well; I'll
discuss that with some of the other folks here.

Reported by csilvers on 2008-06-25 00:10:05

  • Status changed: Started

@alk
Copy link
Contributor Author

alk commented Aug 22, 2015

This was added in perftools 0.99, just released.

Reported by csilvers on 2008-09-19 20:09:38

  • Status changed: Fixed

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

No branches or pull requests

1 participant