Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.forth > #59669

Re: allot which initialize the alloted space ?

From Ron Aaron <rambamist@gmail.com>
Newsgroups comp.lang.forth
Subject Re: allot which initialize the alloted space ?
Date 2017-05-21 19:22 +0300
Organization A noiseless patient Spider
Message-ID <ofsemm$2tb$1@dont-email.me> (permalink)
References <ofrun4$e80$1@dont-email.me> <9dc8fce7-889a-40ca-b57c-382d3569620f@googlegroups.com> <ofsapd$le7$1@dont-email.me> <ofse9k$1du$1@dont-email.me>

Show all headers | View raw



On 21/05/2017 19:16, Alex wrote:

> The only time an OS like Windows gives you memory that's not initialised
> to zero is memory you've allocated, used and freed yourself (where
> yourself is anything running in the process) on the heap. It can be
> requested zeroed by passing HEAP_ZERO_MEMORY to HeapAlloc.

Not everyone uses Windows, and if you use "malloc()" you are not
guaranteed that the memory is cleared.  That's what "calloc()" is for.

> 
> VirtualAlloc (the basis of all memory reservation in Windows, including
> the provision of heaps) always zeroes memory.

But that is not the case when a suballocator (e.g. a malloc() library)
is parcelling out the VirtualAlloced chunk.  And when you malloc/free
blocks, you are definitely not guaranteed any zeroed-out memory.

> About the only time you'd need to zero memory is when you're dealing
> with secure info like passwords, and the app should do that before
> passing the memory around or freeing it. Not doing so is a security hole.

Yes indeed, clearing a password buffer is a Good Idea.  You might also
want to do that if you have a struct that should all be zeroes, saving
the time to manually set each field.

> In the future, zeroing persistent memory (persistent stuff faster than
> flash SSD but slower than DRAM) will be very expensive indeed, and will
> normally be done by requesting the device to do it, and not
> programmatically.

Well, we'll see when we get there...

Back to comp.lang.forth | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

allot which initialize the alloted space ? Andreas Klimas <klimas@w3group.de> - 2017-05-21 13:50 +0200
  Re: allot which initialize the alloted space ? Coos Haak <htrofhc@gmail.com> - 2017-05-21 14:13 +0200
  Re: allot which initialize the alloted space ? hughaguilar96@gmail.com - 2017-05-21 08:01 -0700
    Re: allot which initialize the alloted space ? Ron Aaron <rambamist@gmail.com> - 2017-05-21 18:16 +0300
      Re: allot which initialize the alloted space ? hughaguilar96@gmail.com - 2017-05-21 09:02 -0700
        Re: allot which initialize the alloted space ? Ron Aaron <rambamist@gmail.com> - 2017-05-21 19:17 +0300
          Re: allot which initialize the alloted space ? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2017-05-22 11:22 +0000
          Re: allot which initialize the alloted space ? hughaguilar96@gmail.com - 2017-05-24 08:03 -0700
            Re: allot which initialize the alloted space ? Alex <alex@rivadpm.com> - 2017-05-24 16:58 +0100
        Re: allot which initialize the alloted space ? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2017-05-22 07:40 +0000
          Re: allot which initialize the alloted space ? Mark Wills <markwills1970@gmail.com> - 2017-05-22 08:02 -0700
            Re: allot which initialize the alloted space ? "HAA" <someone@microsoft.com> - 2017-05-24 16:40 +1000
          Re: allot which initialize the alloted space ? hughaguilar96@gmail.com - 2017-05-22 13:27 -0700
      Re: allot which initialize the alloted space ? Alex <alex@rivadpm.com> - 2017-05-21 17:16 +0100
        Re: allot which initialize the alloted space ? Ron Aaron <rambamist@gmail.com> - 2017-05-21 19:22 +0300
          Re: allot which initialize the alloted space ? Alex <alex@rivadpm.com> - 2017-05-21 18:03 +0100
          Re: allot which initialize the alloted space ? albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2017-05-21 20:46 +0200
            Re: allot which initialize the alloted space ? Alex <alex@rivadpm.com> - 2017-05-21 20:34 +0100
      Re: allot which initialize the alloted space ? "HAA" <someone@microsoft.com> - 2017-05-24 16:41 +1000
  Re: allot which initialize the alloted space ? Julian Fondren <julian.fondren@gmail.com> - 2017-05-21 08:36 -0700

csiph-web