]> git.sesse.net Git - stockfish/commit
Properly set to zero stuff returned by 'new'
authorMarco Costalba <mcostalba@gmail.com>
Thu, 7 Oct 2010 02:55:08 +0000 (03:55 +0100)
committerMarco Costalba <mcostalba@gmail.com>
Thu, 7 Oct 2010 02:57:33 +0000 (03:57 +0100)
commit9ca4359f3691305fc5e3306c3084c83557ce09c0
tree24e292688fc38a6c692b800fe0cedacdef8533b1
parentf00c976bb22bc4dbcb2dbb0801f93fc8b6553a90
Properly set to zero stuff returned by 'new'

Language guarantees that c'tor is called, but without any c'tor
it happens to work by accident because OS zeroes out the freshly
allocated pages. The problem is that if I deallocate and allocate
again, the second time pages are no more newly come by the OS and
so could contain stale info.

A practical case could be if we change TT size or numbers of
threads on the fly while already running.

Bug spotted by Justin Blanchard.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
src/material.cpp
src/pawns.cpp
src/tt.cpp