| 546 | |
| 547 | #ifdef HAVE_MALLOC_INFO |
| 548 | static std::string RPCMallocInfo() |
| 549 | { |
| 550 | char *ptr = nullptr; |
| 551 | size_t size = 0; |
| 552 | FILE *f = open_memstream(&ptr, &size); |
| 553 | if (f) { |
| 554 | malloc_info(0, f); |
| 555 | fclose(f); |
| 556 | if (ptr) { |
| 557 | std::string rv(ptr, size); |
| 558 | free(ptr); |
| 559 | return rv; |
| 560 | } |
| 561 | } |
| 562 | return ""; |
| 563 | } |
| 564 | #endif |
| 565 | |
| 566 | static RPCHelpMan getmemoryinfo() |