Skip to content

关于writerbuffer初始化Reserve和Grow的长度 #115

@yushan107

Description

@yushan107

constexpr size_t kExpectMinifyRatio = 18;
size_t estimate = node_nums * kExpectMinifyRatio + 64;
wb.Reserve(estimate);

inc_len = str_len * 6 + 32 + 3;
wb.Grow(inc_len);
想问一下,SerializeImpl这个函数里,writerbuffer初始化的长度和Grow的长度是以什么作为考量的,代码里的这些数字代表什么含义呢?最近执行代码的时候发现这里的内存分配感觉有些问题,

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions