Re: having 1.5GB RAM I cannot allocate more than 512MB RAM in 4.10

2005-01-30 Thread Giorgos Keramidas
On 2005-01-30 08:51, [EMAIL PROTECTED] wrote:

 Guys thanks for the help but it doesn't want to work!

Actually, it works, but you are limited by the maximum allowable data
size of the VM system.

 Infact my data size setting in /etc/login.conf is unlimited by
 default.

True, but this won't work.  Even if you set datasize to a large number
of bytes, i.e. 8589934592 (800 MB), you are limited by the internal
kernel limit for the maximum data size.

This is defined in /usr/src/sys/i386/include/vmparam.h as:

#defineMAXDSIZ (512UL*1024*1024)   /* max data size */

When the setting of login.conf is applied, the following code runs from
`src/sys/kern/kern_resource.c' (the implementation of the setrlimit(2)
syscall):

int
kern_setrlimit(td, which, limp)
struct thread *td;
u_int which;
struct rlimit *limp;
{
[...]
case RLIMIT_DATA:
if (limp-rlim_cur  maxdsiz)
limp-rlim_cur = maxdsiz;
if (limp-rlim_max  maxdsiz)
limp-rlim_max = maxdsiz;
break;

Thus, the maximum data segment size is limited by the value of
`maxdsiz'.  The `maxdsiz' limit is tunable at boot time, by setting the
kern.maxdsiz option in your `/boot/loader.conf' file.

- Giorgos

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


Re: having 1.5GB RAM I cannot allocate more than 512MB RAM in 4.10

2005-01-30 Thread Louis LeBlanc
On 01/30/05 05:07 PM, Giorgos Keramidas sat at the `puter and typed:
 On 2005-01-30 08:51, [EMAIL PROTECTED] wrote:
 
  Guys thanks for the help but it doesn't want to work!
 
 Actually, it works, but you are limited by the maximum allowable data
 size of the VM system.
 
  Infact my data size setting in /etc/login.conf is unlimited by
  default.
 
 True, but this won't work.  Even if you set datasize to a large number
 of bytes, i.e. 8589934592 (800 MB), you are limited by the internal
 kernel limit for the maximum data size.
 
 This is defined in /usr/src/sys/i386/include/vmparam.h as:
 
 #defineMAXDSIZ (512UL*1024*1024)   /* max data size */
 
 When the setting of login.conf is applied, the following code runs from
 `src/sys/kern/kern_resource.c' (the implementation of the setrlimit(2)
 syscall):
 
 int
 kern_setrlimit(td, which, limp)
 struct thread *td;
 u_int which;
 struct rlimit *limp;
 {
 [...]
 case RLIMIT_DATA:
 if (limp-rlim_cur  maxdsiz)
 limp-rlim_cur = maxdsiz;
 if (limp-rlim_max  maxdsiz)
 limp-rlim_max = maxdsiz;
 break;
 
 Thus, the maximum data segment size is limited by the value of
 `maxdsiz'.  The `maxdsiz' limit is tunable at boot time, by setting the
 kern.maxdsiz option in your `/boot/loader.conf' file.

What system are you getting that from?  I don't see that sysctl var in
5.3:

# sysctl kern.maxdsiz
sysctl: unknown oid 'kern.maxdsiz'
# uname -a
FreeBSD keyslapper.net 5.3-RELEASE-p3 FreeBSD 5.3-RELEASE-p3 #3: Sun
Jan 30 22:16:29 EST 2005 [EMAIL PROTECTED]:/usr/obj/usr/src/sys/KEYSLAPPER  i386

I have the same limitations and the same apparently unlimited
configuration mentioned by the OP.  I also have nothing resembling
MAXDSIZ in my kernel config.

Lou
-- 
Louis LeBlanc  FreeBSD-at-keyslapper-DOT-net
Fully Funded Hobbyist,   KeySlapper Extrordinaire :)
Key fingerprint = C5E7 4762 F071 CE3B ED51  4FB8 AF85 A2FE 80C8 D9A2

Pardo's First Postulate:
  Anything good in life is either illegal, immoral, or fattening.


pgpJbvbjP4QfF.pgp
Description: PGP signature


having 1.5GB RAM I cannot allocate more than 512MB RAM in 4.10

2005-01-29 Thread dkouroun
Dear FreeBSD list,
I have an AMD Athlon-XP with 1.5GB RAM.
Unfortunately my FreeBSD 4.10 throws a memory allocation 
error when in a simple C++ program I try to allocate 
with new 512MB of RAM or more. Until 511MB it goes fine!

Is there any kernel specific feature I should tweak? 
What is the problem here? I didn't have such problems
with 5.3 Release although it is generally more unstable!

Here is the simple C++ program I used:
--

#include iostream
using namespace std;

int main(int argc, char* argv[])
{
   if (argc != 2)
   {
  cout  usage:   argv[0]   mem(memory to allocate in bytes)\n;
  cout  examp:   argv[0]   1024\n;
  exit(1);
   }

   long int bytes = strtol(argv[1], NULL, 0);
   char* buffer = new char[bytes];
   cout  memory allooated succesfully =   bytes/1024.0/1024.0  MB \n;
   delete[] buffer;
   cout  allocated memory is now free\n;
   return 0;
}

#g++ memalloc -o run
#./run 536870912

which when I tried to run gave a:
-
terminate called after throwing an instance of 'std::bad_alloc'
  what():  St9bad_alloc
Abort (core dumped)

Here is the output of my top command:

last pid:   432;  load averages:  0.00,  0.00,  0.00  up 0+00:35:2313:37:10
38 processes:  1 running, 37 sleeping

Mem: 63M Active, 39M Inact, 55M Wired, 24K Cache, 50M Buf, 1343M Free
Swap: 3056M Total, 3056M Free


  PID USERNAME PRI NICE  SIZERES STATETIME   WCPUCPU COMMAND
  183 root   2   0 84824K 19864K select   0:05  0.00%  0.00% XFree86
  190 root   2   0  8916K  7720K poll 0:02  0.00%  0.00% gconfd-2
  360 root   2   0 10620K  9720K select   0:02  0.00%  0.00% emacs
  242 root   2   0 12464K  9124K poll 0:02  0.00%  0.00% metacity
  248 root   2   0 21148K 15472K poll 0:01  0.00%  0.00% nautilus
  246 root   2   0 17032K 13108K poll 0:01  0.00%  0.00% gnome-panel
  264 root   2   0 16104K 12124K poll 0:01  0.00%  0.00% wnck-applet
  266 root   2   0 14148K  9560K poll 0:01  0.00%  0.00% mixer_applet2
  188 root   2   0 16124K 10760K poll 0:01  0.00%  0.00% gnome-session
  197 root   2   0 16076K 10288K poll 0:01  0.00%  0.00% gnome-settings
  268 root   2   0 14924K 11012K poll 0:00  0.00%  0.00% clock-applet
  108 root   2   0   920K   528K select   0:00  0.00%  0.00% moused
  270 root   2   0  4492K  3552K select   0:00  0.00%  0.00% xterm
  432 root  31   0  1912K  1084K RUN  0:00  0.00%  0.00% top
  195 root   2   0  5188K  3588K poll 0:00  0.00%  0.00% bonobo-activat
  250 root   2   0  6552K  3928K poll 0:00  0.00%  0.00% gnome-vfs-daem
  271 root  18   0  1424K  1172K pause0:00  0.00%  0.00% csh
  240 root   2   0  7688K  4656K poll 0:00  0.00%  0.00% gnome-smproxy

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


Re: having 1.5GB RAM I cannot allocate more than 512MB RAM in 4.10

2005-01-29 Thread Matthias Buelow
[EMAIL PROTECTED] wrote:
I have an AMD Athlon-XP with 1.5GB RAM.
Unfortunately my FreeBSD 4.10 throws a memory allocation 
error when in a simple C++ program I try to allocate 
with new 512MB of RAM or more. Until 511MB it goes fine!
what's the output of ulimit -d?
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: having 1.5GB RAM I cannot allocate more than 512MB RAM in 4.10

2005-01-29 Thread antenneX

- Original Message - 
From: Matthias Buelow [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Cc: freebsd-questions@freebsd.org
Sent: Saturday, January 29, 2005 7:01 AM
Subject: Re: having 1.5GB RAM I cannot allocate more than 512MB RAM in
4.10


 [EMAIL PROTECTED] wrote:

  I have an AMD Athlon-XP with 1.5GB RAM.
  Unfortunately my FreeBSD 4.10 throws a memory allocation
  error when in a simple C++ program I try to allocate
  with new 512MB of RAM or more. Until 511MB it goes fine!

 what's the output of ulimit -d?

What's the trick to running ulimit?

command not found yet whereis sez it is a shell builtin command.

Jack

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


Re: having 1.5GB RAM I cannot allocate more than 512MB RAM in 4.10

2005-01-29 Thread markzero
  what's the output of ulimit -d?
 
 What's the trick to running ulimit?
 
 command not found yet whereis sez it is a shell builtin command.
 
 Jack
 

What about limits?

-- 
PGP: http://www.darklogik.org/pub/pgp/pgp.txt
B776 43DC 8A5D EAF9 2126 9A67 A7DA 390F DEFF 9DD1


pgpXZZaTvjCl5.pgp
Description: PGP signature


Re: having 1.5GB RAM I cannot allocate more than 512MB RAM in 4.10

2005-01-29 Thread John
On Sat, Jan 29, 2005 at 08:58:21AM -0600, antenneX wrote:
 
 - Original Message - 
 From: Matthias Buelow [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Cc: freebsd-questions@freebsd.org
 Sent: Saturday, January 29, 2005 7:01 AM
 Subject: Re: having 1.5GB RAM I cannot allocate more than 512MB RAM in
 4.10
 
 
  [EMAIL PROTECTED] wrote:
 
   I have an AMD Athlon-XP with 1.5GB RAM.
   Unfortunately my FreeBSD 4.10 throws a memory allocation
   error when in a simple C++ program I try to allocate
   with new 512MB of RAM or more. Until 511MB it goes fine!
 
  what's the output of ulimit -d?
 
 What's the trick to running ulimit?
 
 command not found yet whereis sez it is a shell builtin command.

You must be using a csh-derivative.  It is a built-in for the Bourne-
shell family of shells.

Now that you bring it up, I'm not sure how you get this functionality
from a csh environment - I guess just create a script that is just
#/bin/sh

ulimit $*

or something like that...

Did you try doing a man ulimit?  It should give the builtin command
support matrix...
-- 

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


Re: having 1.5GB RAM I cannot allocate more than 512MB RAM in 4.10

2005-01-29 Thread John
On Sat, Jan 29, 2005 at 03:04:51PM +, markzero wrote:
   what's the output of ulimit -d?
  
  What's the trick to running ulimit?
  
  command not found yet whereis sez it is a shell builtin command.
  
  Jack
  
 
 What about limits?

Ah - there it is - thanks. (blush)
-- 

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


Re: having 1.5GB RAM I cannot allocate more than 512MB RAM in 4.10

2005-01-29 Thread dkouroun
This is the output of my ulimit:

#ulimit -a | grep data
data seg size (kbytes, -d) 524288
#

So what is next?
Is it possible to embed that information in the kernel? 
Or, how is this information set by default? Is there any specific
.conf file I should edit?

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



Re: having 1.5GB RAM I cannot allocate more than 512MB RAM in 4.10

2005-01-29 Thread markzero
 This is the output of my ulimit:
 
 #ulimit -a | grep data
 data seg size (kbytes, -d) 524288
 #
 
 So what is next?
 Is it possible to embed that information in the kernel? 
 Or, how is this information set by default? Is there any specific
 .conf file I should edit?
 
 Thank you all!

You'll want to change your default segment size in /etc/login.conf.
You'll need to re-generate the database after editing with cap_mkdb too. 

Mark

-- 
PGP: http://www.darklogik.org/pub/pgp/pgp.txt
B776 43DC 8A5D EAF9 2126 9A67 A7DA 390F DEFF 9DD1


pgp7xUO3xDToy.pgp
Description: PGP signature


Re: having 1.5GB RAM I cannot allocate more than 512MB RAM in 4.10

2005-01-29 Thread Matthias Buelow
John wrote:
what's the output of ulimit -d?
You must be using a csh-derivative.  It is a built-in for the Bourne-
shell family of shells.
the csh correspondent is limit.
it only affects the shell and its children (so put a setting in 
/etc/profile, /etc/csh.login, or configure the limit via /etc/login.conf 
if you want it to be global).

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


Re: having 1.5GB RAM I cannot allocate more than 512MB RAM in 4.10

2005-01-29 Thread dkouroun
Guys thanks for the help but it doesn't want to work! 
Infact my data size setting in /etc/login.conf is unlimited by default.

But take a look at the output of the following commands!

# login.conf - login class capabilities database.
#
# Remember to rebuild the database after each change to this file:
#
#   cap_mkdb /etc/login.conf
#
# This file controls resource limits, accounting limits and
# default user environment settings.
#
# $FreeBSD: src/etc/login.conf,v 1.34.2.6 2002/07/02 20:06:18 dillon Exp $
#

# Default settings effectively disable resource limits, see the
# examples below for a starting point to enable them.

# defaults
# These settings are used by login(1) by default for classless users
# Note that entries like cputime set both cputime-cur and cputime-max

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:


#
# A collection of common class names - forward them all to 'default'
# (login would normally do this anyway, but having a class name
#  here suppresses the diagnostic)
#
standard:\
:tc=default:
xuser:\
:tc=default:
staff:\
:tc=default:
daemon:\
:tc=default:
news:\
:tc=default:
dialer:\
:tc=default:

#
# Root can always login
#
# N.B.  login_getpwclass(3) will use this entry for the root account,
#   in preference to 'default'.
root:\
:ignorenologin:\
:tc=default:

#
# Russian Users Accounts. Setup proper environment variables.
#
russian|Russian Users Accounts:\
:charset=KOI8-R:\
:lang=ru_RU.KOI8-R:\
:tc=default:


##
##
##
## Example entries
## 
##
##

## Example defaults
## These settings are used by login(1) by default for classless users
## Note that entries like cputime set both cputime-cur and cputime-max
#
#default:\
#   :cputime=infinity:\
#   :datasize-cur=22M:\
#   :stacksize-cur=8M:\
#   :memorylocked-cur=10M:\
#   :memoryuse-cur=30M:\
#   :filesize=infinity:\
#   :coredumpsize=infinity:\
#   :maxproc-cur=64:\
#   :openfiles-cur=64:\
#   :priority=0:\
#   :requirehome@:\
#   :umask=022:\
#   :tc=auth-defaults:
#
#
##
## standard - standard user defaults
##
#standard:\
#   :copyright=/etc/COPYRIGHT:\
#   :welcome=/etc/motd:\
#   :setenv=MAIL=/var/mail/$,BLOCKSIZE=K:\
#   :path=~/bin /bin /usr/bin /usr/local/bin:\
#   :manpath=/usr/share/man /usr/local/man:\
#   :nologin=/var/run/nologin:\
#   :cputime=1h30m:\
#   :datasize=8M:\
#   :vmemoryuse=100M:\
#   :stacksize=2M:\
#   :memorylocked=4M:\
#   :memoryuse=8M:\
#   :filesize=8M:\
#   :coredumpsize=8M:\
#   :openfiles=24:\
#   :maxproc=32:\
#   :priority=0:\
#   :requirehome:\
#   :passwordtime=90d:\
#   :umask=002:\
#   :ignoretime@:\
#   :tc=default:
#
#
##
## users of X (needs more resources!)
##
#xuser:\
#   :manpath=/usr/share/man /usr/X11R6/man /usr/local/man:\
#   :cputime=4h:\
#   :datasize=12M:\
#   :vmemoryuse=infinity:\
#   :stacksize=4M:\
#   :filesize=8M:\
#   :memoryuse=16M:\
#   :openfiles=32:\
#   :maxproc=48:\
#   :tc=standard:
#
#
##
## Staff users - few restrictions and allow login anytime
##
#staff:\
#   :ignorenologin:\
#   :ignoretime:\
#   :requirehome@:\
#   :accounted@:\
#   :path=~/bin /bin /sbin /usr/bin /usr/sbin /usr/local/bin 
/usr/local/sbin:\
#   :umask=022:\
#   :tc=standard:
#
#
##
## root - fallback for root logins
##
#root:\
#   :path=~/bin /bin /sbin /usr/bin /usr/sbin /usr/local/bin 
/usr/local/sbin:\
#   :cputime=infinity:\
#   :datasize=infinity:\
#   :stacksize=infinity:\
#   :memorylocked=infinity:\
#   :memoryuse=infinity:\
#   :filesize=infinity:\
#   :coredumpsize=infinity:\
#   :openfiles=infinity:\
#   :maxproc=infinity:\
#   :memoryuse-cur=32M:\
#   :maxproc-cur=64:\
#   :openfiles-cur=1024:\
#   :priority=0:\
#   :requirehome@:\
#   :umask=022:\
#   :tc=auth-root-defaults:
#
#
##
##