ydb-platform / ydb

YDB is an open source Distributed SQL Database that combines high availability and scalability with strong consistency and ACID transactions
https://ydb.tech
Apache License 2.0
4.02k stars 582 forks source link

Dump tcmalloc heap stats when hitting soft-limit #11738

Open abyss7 opened 3 days ago

abyss7 commented 3 days ago

Disclaimer By default tcmalloc is responsible for a small amount of used memory in kqp, dq and shards. The most part of memory is used by MKQL allocator. To force all the memory to be allocated through tcmalloc - do build with the -DPROFILE_MEMORY_ALLOCATIONS flag.

Allow to dump the full state of tcmalloc heap into logs:

This trick should work almost always since the parent's full memory state is shared for CoW with child. And since we stop parent's process there should be no extreme memory consumption while printing to logs.