Path: utzoo!attcan!uunet!aplcen!uakari.primate.wisc.edu!zaphod.mps.ohio-state.edu!think!paperboy!meissner From: meissner@osf.org (Michael Meissner) Newsgroups: comp.lang.c Subject: Re: FREE Message-ID: Date: 2 Mar 90 17:44:43 GMT References: <2714@stl.stc.co.uk> <1990Feb27.155133.20341@druid.uucp> <16055@haddock.ima.isc.com> <1990Mar1.140829.17199@druid.uucp> <1990Mar2.152601.8000@cubmol.bio.columbia.edu> Sender: news@OSF.ORG Organization: Open Software Foundation Lines: 23 In-reply-to: ping@cubmol.bio.columbia.edu's message of 2 Mar 90 15:26:01 GMT In article <1990Mar2.152601.8000@cubmol.bio.columbia.edu> ping@cubmol.bio.columbia.edu (Shiping Zhang) writes: | My question is | Why is NOT calloc() made machine independent. | I also often asked (to myself) | Why is NOT malloc() made to initialize the contents automatically? | I simply can not think of any case where the initial contents would | be useful for some purpose and should be preserved. Is the efficiency | a matter here? If you are allocating a very large area, and then set the area to all 0's (or whatever bit pattern you want) on a virtual memory system, it will force each of the pages to be faulted in, which can be bad. For example, if you allocate a 10 meg chunk for the worst case senario, and only use say 256K, clearing the memory would force would touch 9.75 meg of pages uselessly. A friend of mine sped up a linker on exactly this problem. -- Michael Meissner email: meissner@osf.org phone: 617-621-8861 Open Software Foundation, 11 Cambridge Center, Cambridge, MA Catproof is an oxymoron, Childproof is nearly so