Report information
The Basics
Id:
35160
Status:
resolved
Worked:
15 minutes
Priority:
Medium/Medium
Queue:

People
Owner:
Nobody in particular
Requestors:
Cc:
AdminCc:

BugTracker
Version Fixed:
N/A
Version Found:
9.9.3-P2
Versions Affected:
(no value)
Versions Planned:
(no value)
Priority:
(no value)
Severity:
S2 Normal
CVSS Score:
(no value)
CVE ID:
(no value)
Component:
(no value)
Area:
(no value)

Dates
Created:Tue, 07 Jan 2014 15:09:51 -0500
Updated:Wed, 16 Aug 2017 08:16:58 -0400
Closed:Wed, 21 Jan 2015 23:48:16 -0500



This bug tracker is no longer active.

Please go to our Gitlab to submit issues (both feature requests and bug reports) for active projects maintained by Internet Systems Consortium (ISC).

Due to security and confidentiality requirements, full access is limited to the primary maintainers.

CC: Tomas Hozza <thozza@redhat.com>
Subject: freelists in memory context consume memory indefinitely
Date: Tue, 07 Jan 2014 21:09:34 +0100
To: bind9-bugs@isc.org
From: Petr Spacek <pspacek@redhat.com>
Hello, I would like to ask you about details of memory context behavior in BIND 9.9.3-P2, some details seems weird to me. May be that it is a bug or I just misunderstood something ... Thank you very much for your time! I think that small memory blocks which are referenced by "struct isc__mem->freelists" are never freed (I mean returned to the operating system) until the memory context is destroyed, right? I'm attaching small demonstration program which does this: 0) create() empty memory context 1) get() 1 million of 1 KiB blocks 2) put() all the blocks back to the mctx 3) destroy() mctx The program pauses after each step which allows to investigate memory consumption as seen by the operating system. I compile it with: gcc -std=c99 -ldns -lisc -I/usr/include/bind9 -g -O0 -o mctx mctx.c I understand that freelists mechanism saves overhead of the operating system allocator for small blocks, but I'm missing a way how to 'flush' freelists. Use case: I'm developing a database driver for BIND 9 and I'm in situation when the driver does a lot of small allocations during zone loading. My problem is that after initial processing the driver "puts" most of the small blocks back to the mctx but this memory is not returned back to the operating system. I'm not sure if this problem deserves own function for explicit 'freelists flush', but generally I could use that in my code. May be that solution like "automatically flush freelists if ((total - inuse) > inuse)" would be good enough and even the plain BIND could benefit from that. May be that factor 2 is too big, may be that and 1/2 would be more appropriate ... if ((total - inuse) > (inuse >> 1)) Could you recommend something else to me if the approaches mentioned above are not feasible? Thank you very much for your patience with me :-) -- Petr Spacek Red Hat

Message body is not shown because sender requested not to inline it.

There is really no way to do this without a complete redesign of isc_mem.
Subject: Re: [ISC-Bugs #35160] freelists in memory context consume memory indefinitely
Date: Tue, 28 Jan 2014 11:46:44 +0100
To: bind9-bugs@isc.org
From: Petr Spacek <pspacek@redhat.com>
On 27.1.2014 23:16, Mark Andrews via RT wrote: > There is really no way to do this without a complete redesign of isc_mem. I see. I hacked it around in my application, thank you for your time. Have a nice day! -- Petr Spacek @ Red Hat @ Brno office P.S. The hack simply limits number of allocated ISC-events of given type: https://github.com/spacekpe/bind-dyndb-ldap/commit/9280ac76e0c5c8e4880520ef9d222179501d0a70