Re: DRAM data persistence



Jan Panteltje <pNaonStpealmtje@xxxxxxxxx> wrote:

On a sunny day (Tue, 03 Jul 2007 17:46:11 GMT) it happened nico@xxxxxxxxxxx
(Nico Coesel) wrote in <468a8b04.933624270@xxxxxxxxxxxxxx>:

I doubt it. Any modern OS clears the memory before freeing it for use
by other tasks.

This is not correct.

This is very correct otherwise there would be a huge security hole.

There are 2 ways to claim memory, and 'malloc()" is the usual way:
- Function: void * malloc (size_t SIZE)
This function returns a pointer to a newly allocated block SIZE
bytes long, or a null pointer if the block could not be allocated.

The contents of the block are undefined; you must initialize it
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
yourself (or use
alloc' instead; *note Allocating Cleared Space::).

Function: void * calloc (size_t COUNT, size_t ELTSIZE)
This function allocates a block long enough to contain a vector of
COUNT elements, each of size ELTSIZE. Its contents are cleared to
zero before
alloc' returns.


You are qouting the C specification. This doesn't mean it is
implemented that way it just tells you you must expect rubbish. But
like I said, to be absolutely sure no data can be shared between
different tasks unintended, any data used by an application is cleared
(this does not necessarely mean made 0) by the OS before it is
returned to the memory allocation pool.

--
Reply to nico@nctdevpuntnl (punt=.)
Bedrijven en winkels vindt U op www.adresboekje.nl
.



Relevant Pages

  • Re: Explications for malloc ang some questions about pointers
    ... A pointer is a thing that contains the address of some ... block of memory somewhere. ... "malloc" allocates a number of bytes and returns a pointer to ... You have to go through the lists a_tmp and b_tmp, ...
    (comp.lang.c)
  • Re: "Mastering C Pointers"....
    ... > If all the structs are part of a single object (e.g., ... For each pointer, cast it to char* and subtract the ... > details of how mallocallocates memory. ...
    (comp.lang.c)
  • Re: compile
    ... which allocates memory on a garbage-collected heap. ... which identifies some pointer or GCMalloc'd structure as ... in compilation with dummy arguments so as to fake a call to a routine ...
    (comp.lang.lisp)
  • Re: segfault w/ block, but not file scope
    ... >> int main ... When you define this pointer a file scope, ... allocates the necessary memory. ...
    (comp.lang.c)
  • Will this leak memory?
    ... This function allocates an instance of the foo_ptr type, ... void func(const foo_ptr *foo) { ... Now my question is wether the memory set aside by alloc_foowill ... Since I have not stored a pointer to this memory I can not free ...
    (comp.lang.c)