Description
When Sentry server creates a full snapshot, it does the following:
1) Calls fetchFullUpdate() to get a full snapshot. This returns Map<String, Set<String>>
2) Goes through all entries and converts them to a different format, allocating memory again for each element:
for (Map.Entry<String, Set<String>> authzPath : authzPaths.entrySet()) { createAuthzPathsMappingCore(pm, nextHmsImageID, authzPath.getKey(), authzPath.getValue()); }
The original full snapshot is then garbage collected and the new one persisted.
Instead, fetchFullUpdate() should just create the full snapshot immediately in the final form. This way we do not have to allocate twice as much memory as needed.