« Return to Thread: Memory leak

Re: Memory leak

by Marc Palmer Local :: Rate this Message:

Reply to Author | View in Thread


On 5 Sep 2008, at 09:02, Graeme Rocher wrote:

> I believe the issue is that we override the default constructor to
> perform data binding. The binding errors object is bound to either the
> current thread or the current request
>
> Since these errors are scoped to the request they won't be GC'ed until
> the request completes. You could regard this as a bug. One work around
> may be do do:
>
>  for (int i = 0; i < 100000; i++) {
>     def t = new Thing(name: "thing_${i}")
>     t.errors = null
>     Thread.sleep(50); // to allow time to watch things in the profiler
>  }
>
> I'm not sure what a better solution is for now. Maybe we could use a
> ReferenceQueue or something to check if its a candidate for GC'ing and
> then automatically clear the errors... hmmm needs some thought
>

Can't we introduce some new notion where we can allow such GORM  
operations take effect "out of a request/thread context"?

i.e:

AnyDomainClass.batchOperation {
    ... do anything in here and errors will be discarded automatically  
etc ...
}


Marc


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


 « Return to Thread: Memory leak