Slowly memory leak?

Hi all.

I'm using unbound 1.4.16 with following server.

Hi Tomoki,

Hi all.

I'm using unbound 1.4.16 with following server.
==================== FreeBSD9.0(32bit) RAM 4GB 1 CPU

unbound.conf: ==================== msg-cache-size: 250m
rrset-cache-size: 500m module-config: "iterator"

I checked cache memories using "unbound-control stats_noreset".
Increment of msg cache memory is stop at 266MB. Increment of RRset
cache memory is stop at 532MB.

But the memory allocator has fragmentation overhead, this can increase
to double to allocation in total, 500m and 1000m memory. That is the
maximum really.

But, increment of memory usage is not stop. I checked it using ps
command. The result is following. ============================== #
date ; ps aux | head -3 Thu May 17 22:52:40 JST 2012 USER PID
%CPU %MEM VSZ RSS TT STAT STARTED TIME COMMAND root
11 99.0 0.0 0 8 ?? RL 13Apr12 48831:35.16 [idle]
unbound 14313 5.0 68.6 1445512 1426924 ?? Ss 17Apr12
175:47.60 /usr/lo cal/sbin/unbound

# date ; ps aux | head -3 Thu May 17 23:11:18 JST 2012 USER
PID %CPU %MEM VSZ RSS TT STAT STARTED TIME COMMAND
root 11 94.0 0.0 0 8 ?? RL 13Apr12
48848:17.65 [idle] unbound 14313 5.0 68.6 1445512 1426944 ?? Ss
17Apr12 177:11.51 /usr/lo cal/sbin/unbound

Thu May 17 23:22:47 JST 2012 USER PID %CPU %MEM VSZ RSS
TT STAT STARTED TIME COMMAND root 11 90.0 0.0
0 8 ?? RL 13Apr12 48858:33.42 [idle] unbound 14313 6.9
68.6 1445512 1427020 ?? Ss 17Apr12 178:04.08 /usr/lo
cal/sbin/unbound ============================== - Continuously
incremented. But, not always. Sometimes this increment is stop. -
This increment is not synchronized with the number of queries.

I think this is memory fragmentation (the space between allocated
memory blocks, wasted space), that increases slowly.

FreeBSD malloc has debug modes that can give you extra information,
and if that is not sufficient, unbound has an internal alloc-check
mode that tests memory as well (unbound's extra memory checks are
slow) configure with --enable-alloc-lite or with
- --enable-alloc-checks. You can also enable --enable-alloc-nonregional
to see malloc statistics for things that are normally handled by a
special purpose memory allocator.

Best regards,
   Wouter

I'm using unbound 1.4.16 with following server.

same version here

unbound.conf:

msg-cache-size: 250m
rrset-cache-size: 500m

funny: same settings here :slight_smile:

I checked it using ps command. The result is following.

I have looked at my statistics and found also an increasing memory usage.
It's an host dedicated to unbound. No other services. (except backup & system management)

Did not noticed that mem usage till now.

(attachments)

Hi, Wouter

Thank you for your reply.

I had thought the "msg cache memory" usage might be stop at 1000MB if
I set "rrset-cache-size: 500m".

Actually, the "msg cache memory" will NOT be increased more than
about 500MB. "Real" memory usage is slowly increased by memory
fragmentation.
Is this correct?

So, if I set "rrset-cache-size: 500m" and "msg-cache-size: 250m",
real memory usage will be about 1500MB?

Thanks.

Hi Tomoki,

Hi, Wouter

Thank you for your reply.

I had thought the "msg cache memory" usage might be stop at 1000MB
if I set "rrset-cache-size: 500m".

Actually, the "msg cache memory" will NOT be increased more than
about 500MB. "Real" memory usage is slowly increased by memory
fragmentation. Is this correct?

Yes, the counter that unbound reports is not more than 500Mb (what you
configure in unbound.conf). The real memory usage reported by ps,
top, slowly increases because of memory fragmentation. Up to double.

So, if I set "rrset-cache-size: 500m" and "msg-cache-size: 250m",
real memory usage will be about 1500MB?

Theoretically, but the malloc code in FreeBSD is very good and may
keep it lower most of the time.

Best regards,
   Wouter