Date: Fri, 23 Aug 2002 07:15:53 +0200 From: Poul-Henning Kamp <phk@critter.freebsd.dk> To: "Un, SungKyong" <skun@etri.re.kr> Cc: freebsd-hackers@FreeBSD.ORG Subject: Re: userland malloc() and zeroed page allocation in Kernel Message-ID: <16196.1030079753@critter.freebsd.dk> In-Reply-To: Your message of "Fri, 23 Aug 2002 11:09:07 %2B0900." <001601c24a4a$121fbb60$1bf2fe81@etri.re.kr>
next in thread | previous in thread | raw e-mail | index | archive | help
In message <001601c24a4a$121fbb60$1bf2fe81@etri.re.kr>, "Un, SungKyong" writes: >But when I try to test this, something strange happed. > > for (i=0; i<200;i++) { > malloc(1MB); > check it's all zeroed; > set this block to 'X'; > } > free all allocated memory(200MB); > for (i=0; i<200;i++) { > malloc(1MB); > check it's all 'X'; > } You cannot trust the value of memory you have free(3)'ed to stay until you malloc(3) again. -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk@FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?16196.1030079753>