From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,ab4f67f984ef04f9 X-Google-Attributes: gid103376,public Path: controlnews3.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!newsfeed.r-kom.de!newsfeed00.sul.t-online.de!newsmm00.sul.t-online.de!t-online.de!news.t-online.com!not-for-mail From: Martin Krischik Newsgroups: comp.lang.ada Subject: Re: Is the Ada run-time required to detect out-of-memory Date: Wed, 26 May 2004 18:20:16 +0200 Organization: AdaCL Message-ID: <1459490.rBJp702xU0@linux1.krischik.com> References: <878yfmiuak.fsf@insalien.org> <2023994.aDeWvtcRlF@linux1.krischik.com> Reply-To: krischik@users.sourceforge.net Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit X-Trace: news.t-online.com 1085588433 00 9426 Si3MGYu68P2IHLY 040526 16:20:33 X-Complaints-To: usenet-abuse@t-online.de X-ID: EBcxIBZfZeheUErfmqFEuTg8Dk45GBQoqSrM7NcCmHJyysqv4sa0s9 User-Agent: KNode/0.7.7 Xref: controlnews3.google.com comp.lang.ada:857 Date: 2004-05-26T18:20:16+02:00 List-Id: Duncan Sands wrote: >> Does calloc know when it gets a new page and when is gets recycled page? > > This is not really a recycled page. In any case, the answer is probably > "no". I was thinking about pages recycled by free (). >> After all the simplest calloc implementation would be: >> >> void* >> calloc(size_t nmemb, size_t size) >> { >> auto void* result = malloc (nmemb * size); >> memset (result, '\0', nmemb * size); >> return result; >> } > > It's more efficient to not have to zero a page unless you write to it - in > fact to not really have any physical pages at all until you write to them. Remember: Not all memory for malloc and calloc come staid from the OS. Some have been freed by free (); With Regards Martin -- mailto://krischik@users.sourceforge.net http://www.ada.krischik.com