home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: sparky!uunet!munnari.oz.au!cs.mu.OZ.AU!munta.cs.mu.OZ.AU!fjh
- From: fjh@munta.cs.mu.OZ.AU (Fergus James HENDERSON)
- Subject: Re: How many malloc's can I use?
- Message-ID: <9223121.15315@mulga.cs.mu.OZ.AU>
- Sender: news@cs.mu.OZ.AU
- Organization: Computer Science, University of Melbourne, Australia
- References: <1992Aug17.181615.11905@proxxi.se>
- Date: Tue, 18 Aug 1992 11:27:02 GMT
- Lines: 29
-
- elias@proxxi.se (Elias M}rtensson (proxxi)) writes:
-
- >Does ANSI C specify the maximum number of malloc calls that can safely
- >be made? Can I do a couple of thousand malloc's and still count on
- >that everything will work fine? I am not interested in any
- >descriptions of the MS-DOS limitations or anything like that. I just
- >want to know what ANSI C says.
- >
- >And does ANSI C specify that largest block of memory that can be
- >malloc'ed?
-
- I am fairly sure that the following would be a ANSI-conforming implementation
- for malloc:
-
- void *malloc(size_t size) {
- errno = E_THIS_SYSTEM_DOESNT_HAVE_DYNAMIC_ALLOCATION;
- return 0;
- }
-
- In other words, I fairly ANSI does not make any guarantees as to the amount
- of memory that can be allocated with malloc. The only constraint is that if
- for whatever reason it cannot allocate the desired amount, it must return
- a null pointer after setting errno to an appropriate value.
-
- --
- Fergus Henderson fjh@munta.cs.mu.OZ.AU
- This .signature VIRUS is a self-referential statement that is true - but
- you will only be able to consistently believe it if you copy it to your own
- .signature file!
-