Re: premature ENOMEM

2010-02-26 Thread Brad Penoff
Solved!!!

Peter Lei of Cisco noticed this application uses mmap rather than
malloc so I could get what I wanted (go beyond 200 MB without ENOMEM)
if I adjusted sysctl -w vm.max_proc_mmap to be a higher value.

Thanks so much for everyone's help,
brad

On Fri, Feb 26, 2010 at 8:12 AM, Brad Penoff  wrote:
> Thanks Anton for the advice about a low kern.maxdsiz .  Does that work
> on your machine?  I tried to give instructions in the original post so
> that anyone can tune their machine and try to see what I am seeing.
> Can others try to see on their own machines if the suggestions work?
> I'll do anything to help (even provide machines, if need be).  I'm
> surprised how difficult this is FreeBSD compared to Linux and Mac OS
> X, but I think FreeBSD will be the most performant if I can get over
> this hump.
>
> On my machine, I had kern.maxdsiz, kern.maxssiz, and kern.dfldsiz all
> set to 2147483648 to match the 2 GB on my machine; that wasn't working
> though.  I tried to modify but had much worse results...
>
> I set this:
> kern.maxdsiz="100"
> kern.maxssiz="2147483648"
> kern.dfldsiz="2147483648"
> ... and NFS didn't load.
>
> I set this:
> kern.maxdsiz="0"
> kern.maxssiz="2147483648"
> kern.dfldsiz="2147483648"
> ... and sshd didn't load!
>
> What combination should I try or what combination did you have in
> mind?  Please excuse my ignorance.
>
> Also, I don't understand the link you sent... was it mistyped?  It
> seems to go to some index and not any advice on this matter...
> http://docs.freebsd.org/cgi/mid.cgi?200207291839.g6TIduVw055637
>
> Thanks again for your help and ahead of time to anyone else's... I'm
> getting a bit desperate and I'm surprised how difficult this is to get
> working in FreeBSD when it was so simple in Linux and Mac OS X.  The
> thing is, I typically use FreeBSD for the best performance but I can't
> even get it to run there, at the moment.
>
> Thanks,
> brad
>
>
> On Thu, Feb 25, 2010 at 10:49 PM, Brad Penoff  wrote:
>> Greetings,
>>
>> I have a 32-bit machine with 2 GB running FreeBSD 8.  I have a complex
>> application that starts getting ENOMEM once the resident memory is
>> about 200 MB.  I adjusted the appropriate /boot/loader.conf and
>> /etc/login.conf settings resulting in an increase in the "limit"
>> values to around 2 GB, but still the complex application gives me
>> ENOMEM at 200 MB.  Including swap space, I should be able to handle 3
>> GB in an application.  I need help understanding how I can enable this
>> or why I cannot.
>>
>> I had this same problem on FreeBSD 6.3 about a year and a half ago,
>> but I found an application-level work-around particular for FreeBSD
>> (the full thread is here http://markmail.org/message/5nsld7pb25m5bfja
>> ; but we found no general solution unfortunately ).  This
>> application-level work-around is no longer sufficient so I wanted to
>> revisit the root of this problem I was seeing and hopefully ask this
>> community of smart hackers to give me a hand here...
>>
>> I have created a simplified application that demonstrates this exact
>> same problem and made it easy to reproduce.  I was hoping that some
>> kind and helpful person could take a look at it and help me out.  It
>> doesn't require any editing of code or anything... In the end, I just
>> need to know how to configure my FreeBSD box with 2 GB of RAM to not
>> give me ENOMEM for this application when it is using only 200 MB,
>> something that never happened in the previous unresolved thread
>> reverenced above.
>>
>> This simplified application has a deliberate memory leak but the goal
>> is for it to not give ENOMEM at 200 MB (I want to be able to use about
>> 1.5 GB).  I have created a tarball... I think it may only work on a
>> 32-bit machine.
>>
>> download/wget http://cs.ubc.ca/~penoff/reslim.tgz
>> tar zxf reslim.tgz
>> cd reslim
>> gmake (or make on Linux)
>> sh ./myumem.sh
>>
>> On my system, when this prints our an error message, in "top", I only
>> see about 200 MB of both "SIZE" and "RES" (they are a few numbers
>> off).  The goal is for "SIZE" to be 1.5 GB or higher; "RES" is up to
>> the OS.  For example, on Linux, "SIZE" (called "VIRT") goes as high as
>> 2.8 GB before the system just becomes slow and unusable (never saw
>> ENOMEM).  For FreeBSD, what can I change to increase the possible
>> "SIZE" before I see ENOMEM?  I have tried increasing

Re: premature ENOMEM

2010-02-26 Thread Brad Penoff
Thanks Anton for the advice about a low kern.maxdsiz .  Does that work
on your machine?  I tried to give instructions in the original post so
that anyone can tune their machine and try to see what I am seeing.
Can others try to see on their own machines if the suggestions work?
I'll do anything to help (even provide machines, if need be).  I'm
surprised how difficult this is FreeBSD compared to Linux and Mac OS
X, but I think FreeBSD will be the most performant if I can get over
this hump.

On my machine, I had kern.maxdsiz, kern.maxssiz, and kern.dfldsiz all
set to 2147483648 to match the 2 GB on my machine; that wasn't working
though.  I tried to modify but had much worse results...

I set this:
kern.maxdsiz="100"
kern.maxssiz="2147483648"
kern.dfldsiz="2147483648"
... and NFS didn't load.

I set this:
kern.maxdsiz="0"
kern.maxssiz="2147483648"
kern.dfldsiz="2147483648"
... and sshd didn't load!

What combination should I try or what combination did you have in
mind?  Please excuse my ignorance.

Also, I don't understand the link you sent... was it mistyped?  It
seems to go to some index and not any advice on this matter...
http://docs.freebsd.org/cgi/mid.cgi?200207291839.g6TIduVw055637

Thanks again for your help and ahead of time to anyone else's... I'm
getting a bit desperate and I'm surprised how difficult this is to get
working in FreeBSD when it was so simple in Linux and Mac OS X.  The
thing is, I typically use FreeBSD for the best performance but I can't
even get it to run there, at the moment.

Thanks,
brad


On Thu, Feb 25, 2010 at 10:49 PM, Brad Penoff  wrote:
> Greetings,
>
> I have a 32-bit machine with 2 GB running FreeBSD 8.  I have a complex
> application that starts getting ENOMEM once the resident memory is
> about 200 MB.  I adjusted the appropriate /boot/loader.conf and
> /etc/login.conf settings resulting in an increase in the "limit"
> values to around 2 GB, but still the complex application gives me
> ENOMEM at 200 MB.  Including swap space, I should be able to handle 3
> GB in an application.  I need help understanding how I can enable this
> or why I cannot.
>
> I had this same problem on FreeBSD 6.3 about a year and a half ago,
> but I found an application-level work-around particular for FreeBSD
> (the full thread is here http://markmail.org/message/5nsld7pb25m5bfja
> ; but we found no general solution unfortunately ).  This
> application-level work-around is no longer sufficient so I wanted to
> revisit the root of this problem I was seeing and hopefully ask this
> community of smart hackers to give me a hand here...
>
> I have created a simplified application that demonstrates this exact
> same problem and made it easy to reproduce.  I was hoping that some
> kind and helpful person could take a look at it and help me out.  It
> doesn't require any editing of code or anything... In the end, I just
> need to know how to configure my FreeBSD box with 2 GB of RAM to not
> give me ENOMEM for this application when it is using only 200 MB,
> something that never happened in the previous unresolved thread
> reverenced above.
>
> This simplified application has a deliberate memory leak but the goal
> is for it to not give ENOMEM at 200 MB (I want to be able to use about
> 1.5 GB).  I have created a tarball... I think it may only work on a
> 32-bit machine.
>
> download/wget http://cs.ubc.ca/~penoff/reslim.tgz
> tar zxf reslim.tgz
> cd reslim
> gmake (or make on Linux)
> sh ./myumem.sh
>
> On my system, when this prints our an error message, in "top", I only
> see about 200 MB of both "SIZE" and "RES" (they are a few numbers
> off).  The goal is for "SIZE" to be 1.5 GB or higher; "RES" is up to
> the OS.  For example, on Linux, "SIZE" (called "VIRT") goes as high as
> 2.8 GB before the system just becomes slow and unusable (never saw
> ENOMEM).  For FreeBSD, what can I change to increase the possible
> "SIZE" before I see ENOMEM?  I have tried increasing
> /boot/loader.conf values to match my 2 GB RAM (kern.maxdsiz,
> kern.maxssiz, kern.dfldsiz), as well as unlimited values in
> /etc/login.conf, but still 200 MB seems a hard limit.  Any ideas?  Why
> is it not going beyond 200 MB?  Resident memory is equal to memory
> size used by the app so why is it never going to disk to swap before
> ENOMEM comes up?
>
> Thanks a million for any help or advice you could lend.  I would be
> more than willing to help in any way, even providing a machine to try
> this on (I could sponsor an emulab.net account).  Anxious to hear what
> options exist.
>
> Thanks again,
> brad
>
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"


premature ENOMEM

2010-02-25 Thread Brad Penoff
Greetings,

I have a 32-bit machine with 2 GB running FreeBSD 8.  I have a complex
application that starts getting ENOMEM once the resident memory is
about 200 MB.  I adjusted the appropriate /boot/loader.conf and
/etc/login.conf settings resulting in an increase in the "limit"
values to around 2 GB, but still the complex application gives me
ENOMEM at 200 MB.  Including swap space, I should be able to handle 3
GB in an application.  I need help understanding how I can enable this
or why I cannot.

I had this same problem on FreeBSD 6.3 about a year and a half ago,
but I found an application-level work-around particular for FreeBSD
(the full thread is here http://markmail.org/message/5nsld7pb25m5bfja
; but we found no general solution unfortunately ).  This
application-level work-around is no longer sufficient so I wanted to
revisit the root of this problem I was seeing and hopefully ask this
community of smart hackers to give me a hand here...

I have created a simplified application that demonstrates this exact
same problem and made it easy to reproduce.  I was hoping that some
kind and helpful person could take a look at it and help me out.  It
doesn't require any editing of code or anything... In the end, I just
need to know how to configure my FreeBSD box with 2 GB of RAM to not
give me ENOMEM for this application when it is using only 200 MB,
something that never happened in the previous unresolved thread
reverenced above.

This simplified application has a deliberate memory leak but the goal
is for it to not give ENOMEM at 200 MB (I want to be able to use about
1.5 GB).  I have created a tarball... I think it may only work on a
32-bit machine.

download/wget http://cs.ubc.ca/~penoff/reslim.tgz
tar zxf reslim.tgz
cd reslim
gmake (or make on Linux)
sh ./myumem.sh

On my system, when this prints our an error message, in "top", I only
see about 200 MB of both "SIZE" and "RES" (they are a few numbers
off).  The goal is for "SIZE" to be 1.5 GB or higher; "RES" is up to
the OS.  For example, on Linux, "SIZE" (called "VIRT") goes as high as
2.8 GB before the system just becomes slow and unusable (never saw
ENOMEM).  For FreeBSD, what can I change to increase the possible
"SIZE" before I see ENOMEM?  I have tried increasing
/boot/loader.conf values to match my 2 GB RAM (kern.maxdsiz,
kern.maxssiz, kern.dfldsiz), as well as unlimited values in
/etc/login.conf, but still 200 MB seems a hard limit.  Any ideas?  Why
is it not going beyond 200 MB?  Resident memory is equal to memory
size used by the app so why is it never going to disk to swap before
ENOMEM comes up?

Thanks a million for any help or advice you could lend.  I would be
more than willing to help in any way, even providing a machine to try
this on (I could sponsor an emulab.net account).  Anxious to hear what
options exist.

Thanks again,
brad
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"


Re: resident memory limit

2008-05-30 Thread Brad Penoff
On Wed, May 21, 2008 at 11:46 AM, Joshua Isom <[EMAIL PROTECTED]> wrote:
>
> On May 21, 2008, at 12:36 PM, Bill Moran wrote:
>
>> In response to "Brad Penoff" <[EMAIL PROTECTED]>:
>>>
>>> On Wed, May 21, 2008 at 6:09 AM, Bill Moran <[EMAIL PROTECTED]>
>>> wrote:
>>>>
>>>> In response to "Brad Penoff" <[EMAIL PROTECTED]>:
>>>>
>>>>> On Tue, May 20, 2008 at 2:39 PM, Brad Penoff <[EMAIL PROTECTED]> wrote:
>>>>>>
>>>>>> On Tue, May 20, 2008 at 1:54 PM, Bill Moran <[EMAIL PROTECTED]>
>>>>>> wrote:
>>>>>>>
>>>>>>> In response to "Brad Penoff" <[EMAIL PROTECTED]>:
>>>>>>>>
>>>>>>>> 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.
>>>>>>>
>>>>>>> Have a look at /etc/login.conf and the associated man pages.
>>>>>>>
>>>>>
>>>>> BTW, we've seen the exact behavior on FreeBSD 7 as well (6.3 was
>>>>> reported here).  We've tried on different hardware as well, and keep
>>>>> getting haunted by this resident memory limit that we don't know how
>>>>> to set.
>>>>>
>>>>> Any idea why, in the data I originally reported, I can allocate
>>>>> kern.maxdsiz + swap (see SIZE from top output) for malloc(1 MB) in a
>>>>> while loop, yet the top value for RES is always really low?
>>>>>
>>>>> How come, in contrast, my application starts to report ENOMEM when
>>>>> SIZE is 203 MB and RES is 201 MB?  This is why I titled the thread
>>>>> asking about an unknown (to me ;-) limit for resident memory...
>>>>
>>>> It's called memory overcommit.  If the OS thinks it _might_ be able
>>>> to get you the memory, it will allow it.  You only actually use the
>>>> memory when you start putting data in it (hence the difference between
>>>> SIZE and RES)  Add a statement to fill up the malloc()ed memory with
>>>> some sort of data in your loop, and you'll see different behaviour.
>>>>
>>>> As to what's limiting your application, I'm not sure.  What does the
>>>> output of 'ulimit -a' say?
>>>>
>>>
>>> Thanks again for your time.
>>>
>>>
>>> With the default loader.conf, my "limit -a" output is:
>>>
>>> Resource limits (current):
>>>  cputime  infinity secs
>>>  filesize infinity kB
>>>  datasize   524288 kB
>>>  stacksize   65536 kB
>>>  coredumpsize infinity kB
>>>  memoryuseinfinity kB
>>>  memorylocked infinity kB
>>>  maxprocesses 5547
>>>  openfiles   11095
>>>  sbsize   infinity bytes
>>>  vmemoryuse   infinity kB
>>>
>>> My application starts getting ENOMEM when I have 201 MB of resident
&g

Re: resident memory limit

2008-05-21 Thread Brad Penoff
On Wed, May 21, 2008 at 6:09 AM, Bill Moran <[EMAIL PROTECTED]> wrote:
> In response to "Brad Penoff" <[EMAIL PROTECTED]>:
>
>> On Tue, May 20, 2008 at 2:39 PM, Brad Penoff <[EMAIL PROTECTED]> wrote:
>> > On Tue, May 20, 2008 at 1:54 PM, Bill Moran <[EMAIL PROTECTED]> wrote:
>> >> In response to "Brad Penoff" <[EMAIL PROTECTED]>:
>> >>>
>> >>> 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.
>> >>
>> >> Have a look at /etc/login.conf and the associated man pages.
>> >>
>>
>> BTW, we've seen the exact behavior on FreeBSD 7 as well (6.3 was
>> reported here).  We've tried on different hardware as well, and keep
>> getting haunted by this resident memory limit that we don't know how
>> to set.
>>
>> Any idea why, in the data I originally reported, I can allocate
>> kern.maxdsiz + swap (see SIZE from top output) for malloc(1 MB) in a
>> while loop, yet the top value for RES is always really low?
>>
>> How come, in contrast, my application starts to report ENOMEM when
>> SIZE is 203 MB and RES is 201 MB?  This is why I titled the thread
>> asking about an unknown (to me ;-) limit for resident memory...
>
> It's called memory overcommit.  If the OS thinks it _might_ be able
> to get you the memory, it will allow it.  You only actually use the
> memory when you start putting data in it (hence the difference between
> SIZE and RES)  Add a statement to fill up the malloc()ed memory with
> some sort of data in your loop, and you'll see different behaviour.
>
> As to what's limiting your application, I'm not sure.  What does the
> output of 'ulimit -a' say?
>

Thanks again for your time.


With the default loader.conf, my "limit -a" output is:

Resource limits (current):
  cputime  infinity secs
  filesize infinity kB
  datasize   524288 kB
  stacksize   65536 kB
  coredumpsize infinity kB
  memoryuseinfinity kB
  memorylocked infinity kB
  maxprocesses 5547
  openfiles   11095
  sbsize   infinity bytes
  vmemoryuse   infinity kB

My application starts getting ENOMEM when I have 201 MB of resident memory.



When I change my loader.conf to match the 2 GB of physical memory that I have:
kern.maxdsiz="2147483648"
kern.maxssiz="2147483648"
kern.dfldsiz="2147483648"

...and reboot, then my "limit -a" output is:

Resource limits (current):
  cputime  infinity secs
  filesize infinity kB
  datasize  2097152 kB
  stacksize 2097152 kB
  coredumpsize infinity kB
  memoryuseinfinity kB
  memorylocked infinity kB
  maxprocesses 5547
  openfiles   11095
  sbsize   infinity bytes
  vmemoryuse   infinity kB


However, the application still seems to max out at 201 MB of resident memory.


People suggest to fix my login.conf but the memory related fields are
set to unlimited... Any ideas where this 201 MB limit of resident
memory comes from?


Thanks!
brad



>>
>> Any other suggestions?
>>
>> brad
>>
>> >
>> > Thanks for the prompt reply.
>> >
>> > This system has the default settings for all users set to "unlimited"
>> > for more or less all login.conf categories.  I've pasted them below.
>> > My application uses a raw socket so I was running it as root, which
>> >

Re: resident memory limit

2008-05-21 Thread Brad Penoff
On Tue, May 20, 2008 at 2:39 PM, Brad Penoff <[EMAIL PROTECTED]> wrote:
> On Tue, May 20, 2008 at 1:54 PM, Bill Moran <[EMAIL PROTECTED]> wrote:
>> In response to "Brad Penoff" <[EMAIL PROTECTED]>:
>>>
>>> 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.
>>
>> Have a look at /etc/login.conf and the associated man pages.
>>

BTW, we've seen the exact behavior on FreeBSD 7 as well (6.3 was
reported here).  We've tried on different hardware as well, and keep
getting haunted by this resident memory limit that we don't know how
to set.

Any idea why, in the data I originally reported, I can allocate
kern.maxdsiz + swap (see SIZE from top output) for malloc(1 MB) in a
while loop, yet the top value for RES is always really low?

How come, in contrast, my application starts to report ENOMEM when
SIZE is 203 MB and RES is 201 MB?  This is why I titled the thread
asking about an unknown (to me ;-) limit for resident memory...

Any other suggestions?

brad

>
> Thanks for the prompt reply.
>
> This system has the default settings for all users set to "unlimited"
> for more or less all login.conf categories.  I've pasted them below.
> My application uses a raw socket so I was running it as root, which
> also uses the default settings.
>
> It mentioned that setting memoryuse is the same as setting both -cur
> and -max ; any ideas why memoryuse is saying it's unlimited even
> though it is not?  I tried explicitly setting -cur to 1000M and it
> still started giving ENOMEM around 200 MB resident memory in top...
>
> brad
>
>
> default:\
>:passwd_format=md5:\
>:copyright=/etc/COPYRIGHT:\
>:welcome=/etc/motd:\
>:setenv=MAIL=/var/mail/$,BLOCKSIZE=K,FTP_PASSIVE_MODE=YES:\
>:path=/sbin /bin /usr/sbin /usr/bin /usr/games /usr/local/sbin
> /usr/local/bin /usr/X11R6/bin ~/bin:\
>:nologin=/var/run/nologin:\
>:cputime=unlimited:\
>:datasize=unlimited:\
>:stacksize=unlimited:\
>:memorylocked=unlimited:\
>:memoryuse=unlimited:\
>:filesize=unlimited:\
>:coredumpsize=unlimited:\
>:openfiles=unlimited:\
>:maxproc=unlimited:\
>:sbsize=unlimited:\
>:vmemoryuse=unlimited:\
>:priority=0:\
>:ignoretime@:\
>:umask=022:
>
> root:\
>:ignorenologin:\
>:tc=default:
>
>
>
>> --
>> Bill Moran
>> http://www.potentialtech.com
>>
>>
>
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: resident memory limit

2008-05-20 Thread Brad Penoff
On Tue, May 20, 2008 at 1:54 PM, Bill Moran <[EMAIL PROTECTED]> wrote:
> In response to "Brad Penoff" <[EMAIL PROTECTED]>:
>>
>> 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.
>
> Have a look at /etc/login.conf and the associated man pages.
>

Thanks for the prompt reply.

This system has the default settings for all users set to "unlimited"
for more or less all login.conf categories.  I've pasted them below.
My application uses a raw socket so I was running it as root, which
also uses the default settings.

It mentioned that setting memoryuse is the same as setting both -cur
and -max ; any ideas why memoryuse is saying it's unlimited even
though it is not?  I tried explicitly setting -cur to 1000M and it
still started giving ENOMEM around 200 MB resident memory in top...

brad


default:\
:passwd_format=md5:\
:copyright=/etc/COPYRIGHT:\
:welcome=/etc/motd:\
:setenv=MAIL=/var/mail/$,BLOCKSIZE=K,FTP_PASSIVE_MODE=YES:\
:path=/sbin /bin /usr/sbin /usr/bin /usr/games /usr/local/sbin
/usr/local/bin /usr/X11R6/bin ~/bin:\
:nologin=/var/run/nologin:\
:cputime=unlimited:\
:datasize=unlimited:\
:stacksize=unlimited:\
:memorylocked=unlimited:\
:memoryuse=unlimited:\
:filesize=unlimited:\
:coredumpsize=unlimited:\
:openfiles=unlimited:\
:maxproc=unlimited:\
:sbsize=unlimited:\
:vmemoryuse=unlimited:\
:priority=0:\
:ignoretime@:\
:umask=022:

root:\
:ignorenologin:\
:tc=default:



> --
> Bill Moran
> http://www.potentialtech.com
>
>
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


resident memory limit

2008-05-20 Thread Brad Penoff
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   SIZERES STATETIME   WCPU COMMAND
  978 root4 1180   203M   201M RUN  0:12  0.00% osubw_sctpclien

... separate run...

  969 penoff  1 1250   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   SIZERES STATETIME   WCPU COMMAND
  982 root3 1200   203M   201M RUN  0:13  0.00% osubw_sctpclien

... separate run...

  967 penoff  1 1260   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   SIZERES STATETIME   WCPU COMMAND
  967 root3 1220   203M   201M RUN  0:31  0.00% osubw_sctpclien

... separate run...

  980 root1 1290  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   SIZERES STATETIME   WCPU COMMAND
 1041 root4  200   204M   202M kserel   0:04  0.00% osubw_sctpclien

... separate run...

  967 root1 1210  2050M  2680K RUN  0:07 93.16% malloctest


kern.maxdsiz="30"
no swap file

kernel panic


kern.maxdsiz="30"   # 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   SIZERES STATETIME   WCPU COMMAND
15286 root2 1280 81172K 79080K RUN  1:47  0.00% osubw_sctpclien

... separate run...

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

-
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"