public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Dirk Behme <dirk.behme@googlemail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] Memset 0 in heap initialization?
Date: Thu, 09 Dec 2010 17:14:21 +0100	[thread overview]
Message-ID: <4D01005D.4080409@googlemail.com> (raw)


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 

             reply	other threads:[~2010-12-09 16:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-09 16:14 Dirk Behme [this message]
2011-01-18  5:17 ` [U-Boot] Memset 0 in heap initialization? Dirk Behme
2011-01-18  5:55   ` Kumar Gala

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4D01005D.4080409@googlemail.com \
    --to=dirk.behme@googlemail.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox