apache / brpc

brpc is an Industrial-grade RPC framework using C++ Language, which is often used in high performance system such as Search, Storage, Machine learning, Advertisement, Recommendation etc. "brpc" means "better RPC".
https://brpc.apache.org
Apache License 2.0
16.56k stars 3.98k forks source link

Fix memory leak of ArenaRpcPBMessageFactory #2798

Closed chenBright closed 3 weeks ago

chenBright commented 3 weeks ago

What problem does this PR solve?

Issue Number:

Problem Summary:

What is changed and the side effects?

Changed:

Side effects:


Check List:

sikey647 commented 3 weeks ago

@chenBright 请问下,这里使用 arena.Reset() 是直接释放内存;还是说内存空间保留,只是清理空间上的内容。

chenBright commented 3 weeks ago

析构后释放内

  // Frees all storage allocated by this arena after calling destructors
  // registered with OwnDestructor() and freeing objects registered with Own().
  // Any objects allocated on this arena are unusable after this call. It also
  // returns the total space used by the arena which is the sums of the sizes
  // of the allocated blocks. This method is not thread-safe.
  uint64_t Reset() { return impl_.Reset(); }