Project

General

Profile

Actions

Bug #5576

closed

memory leak in ptolemy.data.expr.CachedMethod

Added by Daniel Crawl almost 13 years ago. Updated over 12 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
general
Target version:
Start date:
02/17/2012
Due date:
% Done:

0%

Estimated time:
Bugzilla-Id:
5576

Description

There is a memory leak in CachedMethod where the same method is inserted multiple times into the static hash table _cachedMethods. You can see this by running the attached model created by Jianwu. The model has an Expression actor, which uses trim(), isEmpty(), split(), and map(). The model iterates 1000 times, and afterwards jmap reports there are 1004 CachedMethods in the heap:

jmap -histo:live 6959 | grep CachedMethod
38: 1004 40160 ptolemy.data.expr.CachedMethod

Most of these CachedMethods are for map(). The problem is that each CachedMethod for map() has a different hash code. The hash code for a CachedMethod is computed by using the method's argument types and map()'s first argument is a FunctionType. The hash code for FunctionType is based on the hash code for FieldTypeTerm, which is unique for each instance since it does not override Object.hashCode().


Files

cachedmethod-leak.xml (24.6 KB) cachedmethod-leak.xml Daniel Crawl, 02/17/2012 03:21 PM
Actions

Also available in: Atom PDF