What does the script look like? BTW: Circular references alone cannot cause memory leak. CRL GC handles them right.
Tomas -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Aaron Clauson Sent: Saturday, July 05, 2008 7:10 PM To: [email protected] Subject: [Ironruby-core] Memory Leak with Certain Script Exceptions Hi, I use the IronRuby scripting engine in a long running server process and came across an issue where the memory utilisation of the process started steadily rising in line with a memory leak. The server process is written in C# (no unmanaged code) and I spent a lot of time double checking and profiling the application to try ensure there were no circular references or static lists keeping hold of objects etc. Eventually I started looking at the Ruby script processing and found that when a script threw certain exceptions the memory utilisation on the process would start steadily incrementing. It's not all exceptions, syntax errors and method missing execeptions seem fine but ArgumentOutOfRange or NullReferenceExceptions exhibit the behaviour. A stack trace of such a call is shown below. I checked the behaviour using the latest version from svn (6 Jul 2008). System.ArgumentOutOfRangeException: startIndex cannot be larger than length of string. Parameter name: startIndex at System.String.InternalSubStringWithChecks(Int32 startIndex, Int32 length, Boolean fAlwaysCopy) at _stub_##44143(Closure , CallSite , CodeContext , Object , Int32 ) at Microsoft.Scripting.Utils.InvokeHelper`6.Invoke(Object arg0, Object arg1, Object arg2, Object arg3, Object arg4) at Microsoft.Scripting.Utils.ReflectedCaller.InvokeInstance(Object instance, Object[] args) at Microsoft.Scripting.Actions.ActionBinder.UpdateSiteAndExecute[T](CodeContext context, CallSite`1 site, Object[] args) at Microsoft.Scripting.Actions.UpdateDelegates.Update2[T0,T1,TRet](CallSite site, CodeContext context, T0 arg0, T1 arg1) at Initialize##44129(Closure , CodeContext ) at Microsoft.Scripting.ScriptCode.Run(CodeContext context, Boolean tryEvaluate) at Microsoft.Scripting.ScriptCode.Run(Scope scope, Boolean tryEvaluate) at Microsoft.Scripting.ScriptCode.Run(Scope scope) at Microsoft.Scripting.SourceUnit.Execute(Scope scope, ErrorSink errorSink) at Microsoft.Scripting.SourceUnit.Execute(Scope scope) at Microsoft.Scripting.Hosting.ScriptScope.Execute(String code) Regards, Aaron -- Posted via http://www.ruby-forum.com/. _______________________________________________ Ironruby-core mailing list [email protected] http://rubyforge.org/mailman/listinfo/ironruby-core _______________________________________________ Ironruby-core mailing list [email protected] http://rubyforge.org/mailman/listinfo/ironruby-core
