Methods, apparatus and computer readable medium for handling error
correction in a memory are disclosed. In some embodiments, after an
attempt is made to write original data to a `target` memory, data is read
back from the target memory in a `first read operation`, thereby
generating first read data. After the first read operation, the first
read data is compared to the original data and/or an indication of a
difference between the original data and the first data is determined.
The information obtained by effecting the data-comparison and/or
information related to the difference indication is used when correcting
errors in data read back from the target memory in a `second read
operation.`. The presently-disclosed teachings are applicable to any kind
of memory including (i) non-volatile memories such as flash memory,
magnetic memory and optical storage and (ii) volatile memory such as SRAM
or DRAM.