This CL changes multiple things to improve performance (notably on
Android).We introduce a class that implements a cache for the Secondary.
- change the Secondary "freelist" to an array. By keeping free secondary blocks linked together through their headers, we were keeping a page per block, which isn't great. Also we now touch less pages when walking the new "freelist".
- fix an issue with the freelist getting full: if the pattern is an ever increasing size malloc then free, the freelist would fill up and entries would not be used. So now we empty the list if we get to many "full" events;
- use the global release to os interval option for the secondary: it was too costly to release all the time, particularly for pattern that are malloc(X)/free(X)/malloc(X). Now the release will only occur after the selected interval, when going through the deallocate path;
- allow release of the BatchClassId class: it is releasable, we just have to make sure we don't mark the batches containing batches pointers as free.
- change the default release interval to 1s for Android to match the current Bionic allocator configuration. A patch is coming up to allow changing it through mallopt.
- lower the smallest class that can be released to PageSize/64.