<font size=1 face="Segoe UI">We have a java application which has a native
component written in C, that makes use of JNI to manage several of our
objects that we directly allocate via jemalloc. One of the goals
for our C code is to not allow our processes RSS size to grow beyond a
certain point. To do this our app monitors jemallocs stats.cactive,
when it sees that cactive reach a certain point we write certain some of
our objects to disk then we free the allocated memory. In this case,
the objects that we are freeing are 4K and above, so when we free the pages
holding these objects should no longer be active. That part seems
to be working.</font>
<br>
<br><font size=1 face="Segoe UI">After several hours of running our application
at full load, we start to see our RSS go beyond what is expected. This
unexpected growth seems to happen faster for some instances of our application
vs others. I compared the /proc smaps file between instances of our
app that had a high RSS to those with expected RSS. In both cases
smap shows a really large map that I think belongs to jemalloc. I
believe it belongs to jemalloc, because if it didn't the sum of jemallocs
active size + the RSS size of this map goes well beyond our processes overall
RSS size. </font>
<br>
<br><font size=1 face="Segoe UI">The thing that is really strange about
this mmap is that it's Private_Clean sizes is really high, e.g. 1.4 GBs.
I don't know much about private clean pages, other than what a few
google searchs told me about them being pages that have not been modified
since they were mapped. I'm hopeful that you can tell me more about
private clean pages and if/why jemalloc would have maps with such high
private clean pages.</font>
<br>
<br><font size=1 face="Segoe UI">Here's one such map from my smaps file
and the jemalloc stats around the same time. At this time /proc status
showed our VmRSS size was 10440804 kB:</font>
<br>
<br><font size=1 face="Segoe UI">7f41dc200000-7f437a400000 rw-p 00000000
00:00 0 </font>
<br><font size=1 face="Segoe UI">Size:
6785024 kB</font>
<br><font size=1 face="Segoe UI">Rss:
4037056 kB</font>
<br><font size=1 face="Segoe UI">Pss:
4037056 kB</font>
<br><font size=1 face="Segoe UI">Shared_Clean:
0 kB</font>
<br><font size=1 face="Segoe UI">Shared_Dirty:
0 kB</font>
<br><font size=1 face="Segoe UI">Private_Clean: 1499364 kB</font>
<br><font size=1 face="Segoe UI">Private_Dirty: 2537692 kB</font>
<br><font size=1 face="Segoe UI">Referenced: 2536428
kB</font>
<br><font size=1 face="Segoe UI">Swap:
0 kB</font>
<br><font size=1 face="Segoe UI">KernelPageSize: 4
kB</font>
<br><font size=1 face="Segoe UI">MMUPageSize:
4 kB</font>
<br>
<br><font size=1 face="Segoe UI">Jemalloc stats:</font>
<br>
<br><font size=1 face="Segoe UI">___ Begin jemalloc statistics ___</font>
<br><font size=1 face="Segoe UI">Version: 3.3.1-0-g9ef9d9e8c271cdf14f664b871a8f98c827714784</font>
<br><font size=1 face="Segoe UI">Assertions disabled</font>
<br><font size=1 face="Segoe UI">Run-time option settings:</font>
<br><font size=1 face="Segoe UI"> opt.abort: false</font>
<br><font size=1 face="Segoe UI"> opt.lg_chunk: 21</font>
<br><font size=1 face="Segoe UI"> opt.dss: "secondary"</font>
<br><font size=1 face="Segoe UI"> opt.narenas: 96</font>
<br><font size=1 face="Segoe UI"> opt.lg_dirty_mult: 6</font>
<br><font size=1 face="Segoe UI"> opt.stats_print: false</font>
<br><font size=1 face="Segoe UI"> opt.junk: false</font>
<br><font size=1 face="Segoe UI"> opt.quarantine: 0</font>
<br><font size=1 face="Segoe UI"> opt.redzone: false</font>
<br><font size=1 face="Segoe UI"> opt.zero: false</font>
<br><font size=1 face="Segoe UI">CPUs: 24</font>
<br><font size=1 face="Segoe UI">Arenas: 96</font>
<br><font size=1 face="Segoe UI">Pointer size: 8</font>
<br><font size=1 face="Segoe UI">Quantum size: 16</font>
<br><font size=1 face="Segoe UI">Page size: 4096</font>
<br><font size=1 face="Segoe UI">Min active:dirty page ratio per arena:
64:1</font>
<br><font size=1 face="Segoe UI">Chunk size: 2097152 (2^21)</font>
<br><font size=1 face="Segoe UI">Allocated: 7350097392, active: 7438028800,
mapped: 13549699072</font>
<br><font size=1 face="Segoe UI">Current active ceiling: 7486832640</font>
<br><font size=1 face="Segoe UI">chunks: nchunks highchunks
curchunks</font>
<br><font size=1 face="Segoe UI"> 6927
6622 6461</font>
<br><font size=1 face="Segoe UI">huge: nmalloc ndalloc
allocated</font>
<br><font size=1 face="Segoe UI">
0 0
0</font>
<br>
<br><font size=1 face="Segoe UI">Merged arenas stats:</font>
<br><font size=1 face="Segoe UI">assigned threads: 93</font>
<br><font size=1 face="Segoe UI">dss allocation precedence: N/A</font>
<br><font size=1 face="Segoe UI">dirty pages: 1815925:2559 active:dirty,
10091062 sweeps, 30421949 madvises, 135567186 purged</font>
<br><font size=1 face="Segoe UI">
allocated nmalloc ndalloc
nrequests</font>
<br><font size=1 face="Segoe UI">small: 1072125424
106372291 99191380 106372291</font>
<br><font size=1 face="Segoe UI">large: 6277971968
51052119 50542543 51052119</font>
<br><font size=1 face="Segoe UI">total: 7350097392
157424410 149733923 157424410</font>
<br><font size=1 face="Segoe UI">active: 7438028800</font>
<br><font size=1 face="Segoe UI">mapped: 13545504768</font>
<br><font size=1 face="Segoe UI">bins: bin size regs
pgs allocated nmalloc ndalloc
newruns reruns curruns</font>
<br><font size=1 face="Segoe UI">
0 8 501 1 128
30
14 11
0 7</font>
<br><font size=1 face="Segoe UI">
1 16 252 1 672
42
0 11
0 11</font>
<br><font size=1 face="Segoe UI">
2 32 126 1
64 2
0 1
0 1</font>
<br><font size=1 face="Segoe UI">
3 48 84 1 114892800
16709174 14315574 43714
1159683 30488</font>
<br><font size=1 face="Segoe UI">
4 64 63 1 851264
167481 154180
3075 1219 235</font>
<br><font size=1 face="Segoe UI">
5 80 50 1 190426160
36559908 34179581 115227
4236615 50957</font>
<br><font size=1 face="Segoe UI">
6 96 84 2 2112
30 8
11
0 7</font>
<br><font size=1 face="Segoe UI">[7..10]</font>
<br><font size=1 face="Segoe UI"> 11
224 72 4 224
1
0 1
0 1</font>
<br><font size=1 face="Segoe UI">[12]</font>
<br><font size=1 face="Segoe UI"> 13
320 63 5 765952000 52935623
50542023 64485 14712013
40300</font>
<br><font size=1 face="Segoe UI">[14..27]</font>
<br><font size=1 face="Segoe UI">large: size pages
nmalloc ndalloc nrequests
curruns</font>
<br><font size=1 face="Segoe UI">[1]</font>
<br><font size=1 face="Segoe UI"> 8192
2 30
8 30
22</font>
<br><font size=1 face="Segoe UI"> 12288
3 51050157 50542023 51050157
508134</font>
<br><font size=1 face="Segoe UI"> 16384
4 1920 512
1920 1408</font>
<br><font size=1 face="Segoe UI">[13]</font>
<br><font size=1 face="Segoe UI"> 73728
18 1
0 1
1</font>
<br><font size=1 face="Segoe UI">[23]</font>
<br><font size=1 face="Segoe UI"> 172032
42 1
0 1
1</font>
<br><font size=1 face="Segoe UI">[214]</font>
<br><font size=1 face="Segoe UI"> 1052672 257
10
0 10
10</font>
<br><font size=1 face="Segoe UI">[252]</font>
<br><font size=1 face="Segoe UI">--- End jemalloc statistics ---</font>
<br>
<br>
<br><font size=1 face="Segoe UI">Any help is greatly appreciated</font>
<br><font size=1 face="Segoe UI">.</font>