Subject: Re: ABOUT - fork: Cannot allocate memory
To: Sadilmar Goularte <sadilmar@logocenter.com.br>
From: Aaron Mildenstein <buh@mildenstein.net>
List: port-macppc
Date: 04/11/2002 09:50:36
I'm CC-ing this to port-macppc@netbsd.org to get any corrections or
suggestions.  I try to disclaim what I know I do not know.  I do know what
worked for me, and I'm pointing it out.

I did find out something, which is more of a work-around than a fix.
Before I explain what happened, catalog how much RAM and SWAP you have.  I
have 512M of RAM, and a logical conclusion of 2x the RAM for SWAP, or 1G.
I read of another problem, which I had, where in older G3 type machines,
on first boot the machine would panic when it tried to turn on the swap,
or it would hang or something.  I cheated, and manually added the swap
before that part of the script (this was my second attempt at installing
NetBSD), and the SWAP seemed to allocate ok.  After this, however, I got
those annoying "fork: Cannot allocate memory" messages, in spite of the
fact that I had 439M of free memory.  What I found is that the kernel is
trying to allocate SWAP, and because of some limitation somewhere (and its
this part of the question I can't answer: Why the limit, and how much?) it
was unable to allocate memory.  NetBSD has switched, or so I read, to a
unified memory architecture, where it is no longer necessary to make
monstrous amounts of swap space.  I don't pretend to fully understand it,
but perhaps the kernel understands the limits of the motherboard.  My
motherboard should be able to use 768M of RAM.  I have 512, but when you
add 1G of swap, the total becomes 1.5G.  If the kernel can't handle more
than the motherboard's physical limits (I could be way wrong on this,
haven't had a chance to test my theory), then that would explain a lot.
Under this assumption, I could have a swap of 256M, bringing my memory
total to the ceiling of 768M.

My workaround?  I just disabled swap in /etc/fstab and restarted the box.
I still have over 400MB of free RAM when I run top, but I no longer have
"fork: Cannot allocate memory" messages.  Hope that helps you out!

Aaron Mildenstein

On Thu, 11 Apr 2002, Sadilmar Goularte wrote:

> Date: Thu, 11 Apr 2002 08:43:18 -0300
> From: Sadilmar Goularte <sadilmar@logocenter.com.br>
> To: buh@mildenstein.net
> Subject: ABOUT  - fork: Cannot allocate memory
>
> Hello Aaron,
> did you get some answer about this message.
> I=B4m running the same problem here.
>
> Thanks in advance.
> Sadilmar.
>
>
> Subject: fork: Cannot allocate memory
> To: None <port-macppc@netbsd.org>
> From: Aaron Mildenstein <buh@mildenstein.net>
> List: port-macppc
> Date: 03/04/2002 17:15:42
> I am running NetBSD 1.5.2 on a Beige PowerMac G3 (OF 2.0.4) 266MHz with
> 512M of RAM.  I have never dipped below 390M of free memory, and yet in m=
y
> daily cronjob email I see "fork: Cannot allocate memory" messages at the
> point where it would fork the /etc/security script, and other such.  I've
> tried recompiling the kernel, and tweaking memory setting to eradicate
> these messages, but to no avail.  Can anyone give me an answer as to why
> this message crops up?  Is it a bug that's been fixed in recent -current
> snapshots?  It this related to the NEWPMAP thread I've seen going around?
> This is my first "at bat" with NetBSD.  I've been a FreeBSD user and
> SysAdmin for a long time now.  I'd love to put this Mac to good use, but
> can't until I can resolve this strange issue.
>
> Any explanations would be most helpful!
>
> Aaron Mildenstein
>
>
> Sadilmar Goularte
> Tecnologia - Logocenter S.A.
>
> LOGIX - A Melhor Solu=E7=E3o em ERP II
>
> Matriz Joinville
> Rua XV de Novembro, 3950 - Gl=F3ria
> CEP 89216-201 - Joinville/SC
> Brasil
> Tel: 47 461-3043
> Fax: 47 461-3001
> Visite nosso site: http://www.logocenter.com.br
>
>
>