-1

I would like to know if with c++ it is possible to get information about heap memory, like some information of all arenas, some information of fastbin, smallbin and so on

trincot
  • 317,000
  • 35
  • 244
  • 286
kzvwvh
  • 1
  • 1
  • 2
    Not in the standard C++. The particular implementation you are using might or might not have some implementation-specific mechanisms for that. – Igor Tandetnik May 08 '21 at 15:03
  • Sorry I forgot, I'm working on ubuntu 20.04.2 – kzvwvh May 08 '21 at 15:46
  • 1
    Related: [https://stackoverflow.com/questions/349889/how-do-you-determine-the-amount-of-linux-system-ram-in-c](https://stackoverflow.com/questions/349889/how-do-you-determine-the-amount-of-linux-system-ram-in-c) – drescherjm May 08 '21 at 15:51
  • See https://www.gnu.org/software/libc/manual/html_node/Statistics-of-Malloc.html – Shawn May 08 '21 at 18:56
  • thanks Shawn, I already used mallinfo but I need some more information, like the addresses of smallbins, tcachebins and so on – kzvwvh May 08 '21 at 21:32

1 Answers1

1

Not in general. The C++ programming language does not have a formal concept of a 'heap', only of dynamic object lifetimes. A given implementation of the C++ standard library will likely have debug facilities for getting information about its allocator, and your OS will have facilities for getting information about process allocations, but these are all specific to your environment, and not part of the language standard.

Sneftel
  • 40,271
  • 12
  • 71
  • 104