Skip to content

Memory Leak in InstanceModelUtil #2924

Description

@joeseibel

When using some of the utility methods in InstanceModelUtil, it is possible to create a memory leak. Internally, InstanceModelUtil caches some computations in the static fields boundSWCache and boundBusConnections. The class also has a method clearCache() which should be called upon each run of every analysis, but sometimes isn't. If the cache is not cleared, then old instance models which are no longer used stay in the caches until OSATE terminates. For example, the class BusLoadModelBuilder, which is part of the Analyze Bus Load analysis, calls methods which populate the cache, but does not call clearCache().

After discussing this with @AaronGreenhouse and @lwrage, we think it is best to simply remove the caches boundSWCache and boundBusConnections as well as the method clearCache() from InstanceModelUtil. In this case, caching seems like an over-optimization without much benefit.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions