Tencent / matrix

Matrix is a plugin style, non-invasive APM system developed by WeChat.
Other
11.65k stars 1.89k forks source link

内存日志对于不同大小的内存块为什么需要分开存储呢? #810

Open zhangjiuzhou opened 1 year ago

zhangjiuzhou commented 1 year ago

想请教一下,小块内存(<128)和大块内存会分开存储,这样做的原因是什么呢?

void allocation_event_db_add(
allocation_event_db *db_context, uint64_t address, uint32_t type_flags, uint32_t object_type, uint32_t size, uint32_t stack_identifier) {
    if ((type_flags & memory_logging_type_alloc) && /*(address & 0x1f) == 0 && */ size <= 128) {
        __allocation_event_db_add(db_context, address, type_flags, object_type, size, stack_identifier);
    } else {
        db_context->allocation_event_list->insert(address, allocation_event(type_flags, object_type, stack_identifier, size));
    }
}