STRATA_METAL_ALLOC_LOG=1: every allocation of 16 MB or more, with the running total (memory budgets on small Macs)
| 269 | |
| 270 | // STRATA_METAL_ALLOC_LOG=1: every allocation of 16 MB or more, with the running total (memory budgets on small Macs) |
| 271 | void alloc_log(const char* what, size_t n) { |
| 272 | static const bool on = std::getenv("STRATA_METAL_ALLOC_LOG") != nullptr; |
| 273 | static std::atomic<uint64_t> tot{0}; |
| 274 | const uint64_t t = tot += n; |
| 275 | if (on && n >= (16u << 20)) std::fprintf(stderr, "strata metal runtime: %s %.1f MB (total %.2f GB)\n", what, n / 1e6, t / 1e9); |
| 276 | } |
| 277 | |
| 278 | Error new_alloc(void** p, size_t bytes, bool host) { |
| 279 | Runtime& r = rt(); |
no outgoing calls
no test coverage detected