Fix a bad bug in memoization cache where buffer memory was not freed properly. (Wrong pointer was passed to halide_free, which was almost always ok as it turned into a free of NULL.)
Fix a bad bug in memoization cache where buffer memory was not freed
properly. (Wrong pointer was passed to halide_free, which was almost
always ok as it turned into a free of NULL.)

Improve cache debugging printfs to write key as one printf and add a
bit more information. (halide_printf on mobile devices often results
in a log line per call. It only makes sense to call it with an entire
line.)

Move locking scopes to cover cache validation as otherwise it will
fail due to race conditions in parallel filters. (Only applies when
CACHE_DEBUGGING is turned on.)


Former-commit-id: f950fa9b4ff3e8efb4d320a6aa3bd25ebb939084
Trass3r/Halide,Trass3r/Halide,darkbuck/Halide,Trass3r/Halide,darkbuck/Halide,Trass3r/Halide,darkbuck/Halide,darkbuck/Halide,darkbuck/Halide,darkbuck/Halide,Trass3r/Halide,Trass3r/Halide,darkbuck/Halide,Trass3r/Halide