From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dirk Behme Date: Tue, 18 Jan 2011 06:17:35 +0100 Subject: [U-Boot] Memset 0 in heap initialization? In-Reply-To: <4D01005D.4080409@googlemail.com> References: <4D01005D.4080409@googlemail.com> Message-ID: <4D35226F.6060702@googlemail.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 09.12.2010 17:14, Dirk Behme wrote: > > In common/dlmalloc.c in the heap initialization mem_malloc_init() [1] > it looks like the whole heap is initialized with zero: > > memset((void *)mem_malloc_start, 0, size); > > What's the reason for doing this? I know that the .bss segment has to > be zeroed at system start up, but why doing this for the heap, too? It > was my understanding that one could make no assumption about the > initial content of memory returned by malloc() (?). > > Sorry if I miss the obvious ;) > > Thanks > > Dirk > > [1] > http://git.denx.de/?p=u-boot.git;a=blob;f=common/dlmalloc.c;h=e9bab09b8eac7c0ec4900a3685f15a807b448c31;hb=refs/heads/master#l1529 Any idea regarding this? Thanks Dirk