Dov, have you put the JavaLoader in your server scope?

If you are using ColdFusion 7, re-initing the JavaLoader will cause a
memory leak.

Details here:
http://www.compoundtheory.com/?action=displayPost&ID=212

Mark

On 6/15/07, Dov Katz <[EMAIL PROTECTED]> wrote:
> For a classloader, I use an instance of JavaLoader.cfc from Mark Mandel, with 
> the oscache-2.3.2.jar added to it.
>
> I have a convenience method to get create a cache:
> <Cffunction name="createCacheAdministrator" output="false" access="public">
>                 <Cfreturn 
> this.create("com.opensymphony.oscache.general.GeneralCacheAdministrator").init()>
> </cffunction>
>
> Then I have DAO CFC's, which hit the DB directly, and MyDAOCacheImpl which 
> subclass the DAO's to intercept "Get" calls and cache them... Example:
>
> -- IN MyDAOCacheImpl
>
> <cffunction name="init" access="public" output="false"
>                 hint="Pseudo Constructor. ">
>                 <cfargument required="true" name="dsn" type="string">
>                 <cfargument required="true" name="loader" >
>                 <cfset Super.init(arguments.dsn)>
>                 <Cfset this.cache=arguments.loader.createCacheAdministrator()>
>                 <Cfset  this.refresh=(60*60*24)>
>                 <cfreturn this />
> </cffunction>
>
> Here's a cached query...
>
> <!--- READ --->
>         <cffunction name="GetGallery" access="public" output="false">
>                 <cfargument required="true" name="id" type="numeric">
>                 <Cfset var key="Gallery_#arguments.id#">
>                 <Cfset var val="">
>                 <Cfset var err="">
>                 <Cftry>
>                         <cfset val= 
> #this.cache.getFromCache(key,javacast("int",this.refresh))#>
>                 <cfcatch>
>                         <Cfset err="">
>                         <cftry>
>                                 <Cfset this.cache.cancelUpdate(key)>
>                                 <Cfscript>
>                                         updated=false;
>                                         val=super.getGallery(arguments.gID);
>                                         this.cache.putInCache(key,val);
>                                         updated=true;
>                                 </Cfscript>
>                         <cfcatch>
>                                 <Cfset err="#cfcatch.message#">
>                         </cfcatch></cftry>
>                         <cfif not UPDATED>
>                                 <Cfset this.cache.cancelUpdate(key)>
>                                 <Cfthrow type="CacheError"  message="Error 
> inserting #key# into the cache: #err#">
>                         </cfif>
>                 </cfcatch></cftry>
>                 <cfreturn val>
>         </cffunction>
>
>
>
> > Post the code for how you are using OSCache. It looks like you are
> > definitely ending up with too many references to internal CF classes
> > on your CFCs. Remember - a CFC does not equate to a single Java object
> > - thus caching concepts that work in the java world may not work
> > exactly the same w/ CFCs.
> >
> > >I'm not sure if these are being sent to the list. Please let me know.
> > Could
> > >really use help in figuring out the memory leak caused by caching my
> > CFC's
> > >in application scope.   Thanks - Dov
> > >
> > >
> > >
> > >http://www.houseoffusion.com/groups/CF-Talk/thread.
> cfm/threadid:52111#281118
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Upgrade to Adobe ColdFusion MX7
The most significant release in over 10 years. Upgrade & see new features.
http://www.adobe.com/products/coldfusion?sdid=RVJR

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:281354
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to