solve database mem leak