fix #829, bad handling of 0 cache size in shared_memory inner_fold and inner_scan