talloc_is_parent() is not, as one might imagine, a direct pointer lookup, or a wrapper around talloc_parent(), but instead confirms if the supplied pointer is in a parent/child relationship up to any depth. This is quite expensive and so becomes the dominant memory operation in LDB search operations. We need to re-evaluate if these calls can be safely omitted in some cases and if not, change talloc_is_parent(foo, parent) to talloc_parent(foo) == parent.
The suspect commit is in Samba 4.12 and later: commit ee2fe56ba0ef6626b634376e8dc2185aa89f8c99 Author: Aaron Haslett <aaronhaslett@catalyst.net.nz> Date: Tue Nov 27 11:07:44 2018 +1300 drepl: memory leak fix Fixes a memory leak where schema reference attached to ldb instance is lost before it can be freed. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14042 Signed-off-by: Aaron Haslett <aaronhaslett@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz> Autobuild-User(master): Garming Sam <garming@samba.org> Autobuild-Date(master): Wed Jul 17 06:17:10 UTC 2019 on sn-devel-184
This bug was referenced in samba master: 8affe4a1e625104de4ca024fdc3e9cd96498aff3
This bug was referenced in samba v4-15-test: 86d3397f852e4e6e5fa5096d91c4263e26742d0f
This bug was referenced in samba v4-15-stable (Release samba-4.15.0rc6): 86d3397f852e4e6e5fa5096d91c4263e26742d0f
This bug was referenced in samba v4-13-test: 02c40fd92dcd7224228dc232d5fdf0738d313a36
This bug was referenced in samba v4-14-test: 59f6d56f4ef4a8cde8a4e50bb6ab1a51093de025
This bug was referenced in samba v4-13-stable (Release samba-4.13.12): 02c40fd92dcd7224228dc232d5fdf0738d313a36
This bug was referenced in samba v4-14-stable (Release samba-4.14.8): 59f6d56f4ef4a8cde8a4e50bb6ab1a51093de025