I doubt it. Any modern OS clears the memory before freeing it for use
by other tasks.
This is not correct.
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.
So normally _nothing_ is done, only processes are killed on power down.
The other issue is that for DRAM I think it is highly unlikely data can
be reliably restored, if if you took out the DRAM modules and
had a special setup to look at these, but perhaps.
Much more important is 'swapspace' as it is on disk, and likely a lot
of data is still there.
Then some modern laptops have a sleep state where _nothing_ is erased,
or even the workspace copied to disk, to be read back in later.
And now we are moving towards FLASH drives and even FLASH memory, where
NOTHING is erased, you switch the PC off, and days later on again,
and it continuous where it was.
Solution is disk encryption, but FLASH will hold data for a hundred years..
Writing other data to disk sectors in swap space takes too much time to do on
power-down (may be a gigabyte or more).
These is no such thing as 100% security.
This is done to prevent security leaks. Shutting down
the computer frees
free() does not clear memory, it only changes a pointer table.
- Function: void free (void *PTR)
The ree' function deallocates the block of memory pointed at by
PTR.
all memory so all memory is cleared before you can
read it.
All memory is cleared in DRAM because refresh and reads stops,
These are just a few issues... there are many more.