Date: Tue, 29 Apr 2008 20:37:12 -0400 From: "Edward Ruggeri" <smallhand@crawblog.com> To: "FreeBSD Questions" <freebsd-questions@freebsd.org> Subject: Dynamic Memory Allocation Limit? Message-ID: <919383240804291737k513360bcje6c4c85dc4621903@mail.gmail.com>
next in thread | raw e-mail | index | archive | help
I have recently been writing an implementation of the sieve of Eratosthenes in C. To find all primes less than N, I dynamically create an array of chars (relatively small datatype) of length N+1 (I know I don't need to represent evens). Everything works great up until around 600 million, at which case memory allocation fails. At this point, I am asking for 600M chars, which is about 572MB (I might be failing to take account of offset?). My system has about 2GB of memory. Top says: Mem: 159M Active, 1113M Inact, 185M Wired, 56M Cache, 112M Buf, 481M Free. >From the man page, I am not completely clear what these values mean. However, I have read elsewhere that memory labeled as inactive should be available for the heap Is there a limit to how much memory may be allocated to a process? Any other reasons someone might think of? I am using FreeBSD 6.3-prerelease, with SMP for a Athlon X2 4200+ (if it makes a difference). Sorry if this is a RTFM question ... Sincerely, -- Ned Ruggeri
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?919383240804291737k513360bcje6c4c85dc4621903>