From owner-freebsd-questions@FreeBSD.ORG Sat Jan 29 11:43:53 2005 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B3DB016A4CE for ; Sat, 29 Jan 2005 11:43:53 +0000 (GMT) Received: from webmail.uoi.gr (webmail.uoi.gr [195.130.120.121]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1B5DA43D3F for ; Sat, 29 Jan 2005 11:43:52 +0000 (GMT) (envelope-from dkouroun@cc.uoi.gr) Received: from webmail.uoi.gr (localhost [127.0.0.1])j0TBhnPW020241 for ; Sat, 29 Jan 2005 13:43:50 +0200 Received: (from wwwrun@localhost) by webmail.uoi.gr (8.12.10/8.12.10/Submit) id j0TBhnIJ020240 for freebsd-questions@freebsd.org; Sat, 29 Jan 2005 13:43:49 +0200 Received: from 212-70-197-171.rod.dialup.tee.gr (212-70-197-171.rod.dialup.tee.gr [212.70.197.171]) by webmail.uoi.gr (IMP) with HTTP for ; Sat, 29 Jan 2005 13:43:49 +0200 Message-ID: <1106999029.41fb76f5a6dd8@webmail.uoi.gr> Date: Sat, 29 Jan 2005 13:43:49 +0200 From: dkouroun@cc.uoi.gr To: freebsd-questions@freebsd.org References: <20050129101330.B3C1D16A4D9@hub.freebsd.org> In-Reply-To: <20050129101330.B3C1D16A4D9@hub.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit User-Agent: Internet Messaging Program (IMP) 3.2.2 X-Originating-IP: 212.70.197.171 Subject: having 1.5GB RAM I cannot allocate more than 512MB RAM in 4.10 X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Jan 2005 11:43:53 -0000 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 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:23 13: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 SIZE RES STATE TIME WCPU CPU 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 pause 0:00 0.00% 0.00% csh 240 root 2 0 7688K 4656K poll 0:00 0.00% 0.00% gnome-smproxy