Bug 12607 - hosts allow produce unproportional memory usage - possible memory leak on initialization
Summary: hosts allow produce unproportional memory usage - possible memory leak on ini...
Status: NEW
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: File services (show other bugs)
Version: 4.4.4
Hardware: x64 Linux
: P5 major (vote)
Target Milestone: ---
Assignee: Samba QA Contact
QA Contact: Samba QA Contact
Depends on:
Reported: 2017-03-02 11:34 UTC by stefan.reusch
Modified: 2018-08-30 00:29 UTC (History)
2 users (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description stefan.reusch 2017-03-02 11:34:33 UTC
We found an memory "leak" in hosts allow code. We run a hugh samba system with many small shares distributed across our network with many different segments, so our hosts allow list has over 300 x /24 network entries (e.g. 10.255.20.). The problem was, every connection has used over 140 MByte of memory what multiplied with our connections resulted in 80 GByte of used memory. We have dumped one of the samba processes to find out which part needs so much memory and we found out, that your hosts allow implementation needs most of them. The list himself has only 3 KByte, but samba allocates also for every host entry additional a string of 255 bytes (possible an array of strings). This would also not result in 140 MByte, but for a reason, which we dont know samba holds not one of those arrays, but rather 2944 of them. We have removed our hosts allow parameter for testing and the memory usage of 140 MByte decreased to 16 MByte. The memory is immediately allocated on process start. So we think the "leak" is only on initialization of the hosts allow parameter. We cant see any further allocation in this scale while the process is running. We could provide a memory dump or other information as required.

Additional some info about our system. We run a centos 7 distribution with latest updates and samba Version 4.4.4 (latest centos version) on an virtualized syklake xeon system.

To repoduce the issue you can add many different hosts allow entries and restart the smb process. The memory usage increase unproportinal. On memory dump of the heap most of space is used to hold those hosts allow entries.

We can provide a memory dump when its needed.
Comment 1 Volker Lendecke 2017-03-02 15:33:28 UTC
Yes, please upload such a memory dump. Maybe from there it's visible what goes wrong without a reproducer. You can also send it to me personally by mail if you don't want it posted on a public website