[ZBX-7741] memory allocator uses more memory for internal purposes than it should Created: 2014 Feb 03  Updated: 2020 Jan 19

Status: Reopened
Project: ZABBIX BUGS AND ISSUES
Component/s: Proxy (P), Server (S)
Affects Version/s: 2.2.1
Fix Version/s: None

Type: Problem report Priority: Trivial
Reporter: Aleksandrs Saveljevs Assignee: Zabbix Development Team
Resolution: Unresolved Votes: 0
Labels: memory
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: File memmalloc-32bit-chunks.diff    
Sprint: Sprint 51 (Apr 2019), Sprint 52 (May 2019), Sprint 53 (Jun 2019), Sprint 54 (Jul 2019), Sprint 57 (Oct 2019)
Story Points: 3

 Description   

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.



 Comments   
Comment by Aleksandrs Saveljevs [ 2014 Mar 10 ]

Related issue: ZBX-7918.

Comment by Andris Zeila [ 2014 Mar 10 ]

Attached the patch from ZBX-7918

Generated at Fri Apr 19 22:35:55 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.