-
Problem report
-
Resolution: Unresolved
-
Trivial
-
None
-
2.2.1
-
Sprint 51 (Apr 2019), Sprint 52 (May 2019), Sprint 53 (Jun 2019), Sprint 54 (Jul 2019), Sprint 57 (Oct 2019)
-
3
After ZBXNEXT-322 was implemented in r36765, the memory allocator started using more memory for internal purposes than it should.
Namely, consider the description of memory allocator at the beginning of src/libs/zbxmemory/memalloc.c. There it is described how a chunk looks like. At the beginning and at the end of the chunk there is the size of the chunk. Before r36765, it used to be 4 bytes on each side for a total of 8 bytes. Now, it is 8 bytes on each side for a total of 16 bytes. So each free and allocated chunk now uses 8 bytes more of memory.
The rationale for the change was that the maximum size for value cache is 64 GB, so 4 bytes is no longer enough to represent that free chunk size. However, since we never allocate more than 2 GB (which itself is extremely unlikely), we can split the initial free chunk of 64 GB into several smaller chunks of free memory.