Files
kotlin-fork/compiler/incremental-compilation-impl
Hung Nguyen 08e6eb07c1 [New IC] Reduce memory usage of classpath snapshot cache
- Remove soft references that are too old.
 - Compute memory usage based on Runtime.totalMemory() instead of
   Runtime.maxMemory() as the latter is not reliable.
 - Remove debug logs that haven't proved to be useful.
 - Collect metrics on the number of cache hits (in addition to cache
   misses).

#KT-52329 In Progress

[New IC] Reduce memory usage of classpath snapshot cache

Use object interning for commonly shared objects. These include:
  - supertypes of classes
  - package names of classes

One experiment showed that with the above optimization, memory usage was
reduced from 660 MB down to 280 MB (+ 4 MB for the interning pool).

More aggressive object interning didn't reduce memory usage much
further, but would increase interning overhead and code complexity, so
we didn't do this to more objects.

Note that this commit optimizes the size of classpath snapshots in
memory, not their serialized data on disk. (I attempted the latter,
but the size was only reduced from 160 MB down to 130 MB, while the code
complexity became much higher as multiple interning pools would need to
be stored to disk and later loaded from disk, each per classpath entry
snapshot or shrunk classpath snapshot.)

#KT-52329 Fixed
2022-05-25 12:59:20 +03:00
..