Please sign in to comment.
Replace malloc() followed by memset() to zero with calloc()
Bionic's calloc() is smart enough to not zero out memory if it gets that memory from an anonyous mmap. Thus, if we use malloc for large allocations, we cause unnecessary memory duplication by following the malloc() with a memset(). An even better approach would be to replace the known large calloc() calls with dvmAllocRegion() allocation. Change-Id: Id308f541c9a040d5929bf991b6c2bfdefb823c3c
- Loading branch information...
Showing with 15 additions and 24 deletions.