On Saturday, January 18, 2014 11:44:53 PM UTC+2, Oskar Berggren wrote:
>
>
> Unfortunately, even with that patch applied, the unit test in my other 
>> post fails -- even though a heap inspection with WinDBG confirms that the 
>> session is no longer rooted and is eligible for collection.
>>
>
> My attempts with dubious knowledge of Windbg seems to confirm that the 
> test itself did indeed maintain a reference to the SessionImpl instance, as 
> a local variable in the stack fram of IsGarbageCollected<TObject>(ref 
> TObject @object, Action<TObject> useObject). I don't know how to explain 
> that, given that the test code attempted to nullify the reference.
>

The second GC.Collect() pass fixed that for me, like Gunnar suggested. I'll 
take another look at it soon-ish to see if your modified test still behaves 
the way I think it should.
 
My first attempt at a fix actually was to discard the _expression 
reference. However, that didn't work -- IIRC because the results of the 
translation maintained another reference to the expression. Changing that 
would have had a considerably bigger change footprint, one that I wasn't 
comfortable with.

Another approach I tried was to replace the stored expression with 
something that wouldn't hold a session reference. Unfortunately, that only 
led to failing queries, largely due to the same reasons.

This change seems difficult to get right, which rather strongly supports 
your opinion about the messiness...

-Lauri

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"nhibernate-development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to