resident memory limit

Brad Penoff penoff at cs.ubc.ca
Tue May 20 20:44:34 UTC 2008


Greetings,

I have an application that runs on Linux or Mac OS X but seems to have
a problem when I run on FreeBSD (6.3 or 7).  The issue is the memory
footprint for the application (osubw_sctpclien below) is quite large;
on Linux it can be as much as 950 MB in resident memory, according to
top.  However, on FreeBSD I start to get ENOMEM always around the time
my resident memory size is about 200 MB.

I read a few posts and have seen people fixing their problems by
adjusting kern.maxdsiz in /boot/loader.conf and/or by adding a swap
file.  I've tried both and for my application, it still seems to be
limited to 200 MB resident memory regardless of maxdsize and swap file
setting.  I wrote a toy application (malloctest below) that calls
malloc in a while(1) and breaks once it gets ENOMEM (doing another
while(1) so it doesn't exit); this application's memory size in top
always matches the kern.maxdsiz setting, however it has a very low
resident memory number, according to top.

I have all the data below from these two applications.  For
malloctest, I can malloc as much as maxdsiz allows (without panic'ing
the kernel).  My main question is, in FreeBSD how can I increase the
permitted resident memory of the system for my application to beyond
200 MB?  Any ideas where this 200 MB resident memory limit is coming
from?  Why (in the last data entry below) does the resident memory
limit become 80 MB after I increase maxdsiz AND use a swap file (the
settings where malloctest can malloc the most!)?

Thanks!
brad


Using FreeBSD 6.3.....


kern.maxdsiz  default setting ( 524288 kB )
no swap file.

Mem: 218M Active, 9184K Inact, 36M Wired, 14M Buf, 1739M Free
Swap: 512M Total, 512M Free

  PID USERNAME  THR PRI NICE   SIZE    RES STATE    TIME   WCPU COMMAND
  978 root        4 118    0   203M   201M RUN      0:12  0.00% osubw_sctpclien

... separate run...

  969 penoff      1 125    0   513M  1144K RUN      0:09 90.73% malloctest

------------------------------------------

kern.maxdsiz  default setting ( 524288 kB )
512 MB swap file.

Mem: 218M Active, 9144K Inact, 36M Wired, 12K Cache, 14M Buf, 1739M Free
Swap: 1024M Total, 1024M Free

  PID USERNAME  THR PRI NICE   SIZE    RES STATE    TIME   WCPU COMMAND
  982 root        3 120    0   203M   201M RUN      0:13  0.00% osubw_sctpclien

... separate run...

  967 penoff      1 126    0   513M  1144K RUN      0:10 94.60% malloctest

------------------------------------------


kern.maxdsiz="2147483648"               # Set the max data size
no swap file.

Mem: 218M Active, 9168K Inact, 36M Wired, 14M Buf, 1739M Free
Swap: 512M Total, 512M Free

  PID USERNAME  THR PRI NICE   SIZE    RES STATE    TIME   WCPU COMMAND
  967 root        3 122    0   203M   201M RUN      0:31  0.00% osubw_sctpclien

... separate run...

  980 root        1 129    0  2050M  2680K RUN      0:12 97.64% malloctest


----------------------------------------

kern.maxdsiz="2147483648"               # Set the max data size
512 MB swap file.

Mem: 220M Active, 12M Inact, 41M Wired, 12K Cache, 20M Buf, 1730M Free
Swap: 1024M Total, 1024M Free

  PID USERNAME  THR PRI NICE   SIZE    RES STATE    TIME   WCPU COMMAND
 1041 root        4  20    0   204M   202M kserel   0:04  0.00% osubw_sctpclien

... separate run...

  967 root        1 121    0  2050M  2680K RUN      0:07 93.16% malloctest

----------------------------------------
kern.maxdsiz="3000000000"
no swap file

kernel panic
----------------------------------------

kern.maxdsiz="3000000000"               # Set the max data size
512 MB swap file.


Mem: 103M Active, 52M Inact, 106M Wired, 112M Buf, 1742M Free
Swap: 1024M Total, 1024M Free

  PID USERNAME  THR PRI NICE   SIZE    RES STATE    TIME   WCPU COMMAND
15286 root        2 128    0 81172K 79080K RUN      1:47  0.00% osubw_sctpclien

... separate run...

  963 penoff      1 122    0  2865M  3500K RUN      0:08 96.62% malloctest

-----------------------------------------


More information about the freebsd-questions mailing list