EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  <20092010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  <20092010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: addMonitor memory leak in JCA
From: "Kasemir, Kay" <[email protected]>
To: "[email protected]" <[email protected]>
Date: Tue, 31 Mar 2009 16:27:32 -0400
Hi:

I think JCA 2.3.1 and also the latest 2.3.2 have a small memory
leak in JNIChannel.addMonitor() resp. JNIMonitor.clear():

They ultimately call JNI code in JNI.cpp, where
"new MonitorID" allocates a small structure that's not
freed up in the clearMonitor counterpart:

JNIEXPORT jlong JNICALL Java_gov_aps_jca_jni_JNI__1ch_1addMonitor(JNIEnv
*env, jclass, jint type, jint length, jlong channelID, jobject callback,
jint mask)
{
  MonitorID* monitorID= new MonitorID;
  monitorID->callback= env->NewGlobalRef(callback);
  checkstatus( env, ca_add_masked_array_event(type,length,CHID(channelID),
&theArrayMonitorCallback,
monitorID->callback,0,0,0,&monitorID->pevid,mask));
  return (jlong)monitorID;
}

JNIEXPORT void JNICALL Java_gov_aps_jca_jni_JNI__1ch_1clearMonitor(JNIEnv
*env, jclass, jlong monitorID)
{
  checkstatus( env, ca_clear_event(((MonitorID*)monitorID)->pevid) );
  env->DeleteGlobalRef(((MonitorID*)monitorID)->callback);

 // Needs something like this?
 // delete ((MonitorID*)monitorID)
}


Thanks,
-Kay



Navigate by Date:
Prev: Re: connections with pasynOctetSyncIO->connect John Hammonds
Next: Re: connections with pasynOctetSyncIO->connect John Hammonds
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  <20092010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: EPICS Meeting Vancouver Rolf Keitel
Next: CLS Openings in the Control and Instrumentation Group Elder Matias
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  <20092010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 31 Jan 2014 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·