Looks like you're descibing current functionality :)
...well, then everything is ok! :-D
But seriously: I tried to explain why you cannot remove the parent continuation :-)
some experiments showed me that it is possible to remove parent continuations in flowscript. But profiling revealed that the benefit is negligible because continuaitons are very small objects. As said, the referenced objects are the problem as every new continuation tree references new objects in the case an object is stored in a local variable.
I don't have a solution for this as I can't find a general rule when a tree can be invalidated, except after some time-out.
One optimization we could add is a maximum continuations per session count. Like a sliding window. So we don't rely on a fix expiration time but additionally expire the oldest ones if we run over a certain amount of continuations per user.
That would make the memory consumption a bit more manageable.
hmmm, I'm not sure if this really helps as only if the *whole* continautions tree (= when the last continuation is invalidated) referenced objects can be removed by the garbage collector.
--
Reinhard Pötz Independent Consultant, Trainer & (IT)-Coach
{Software Engineering, Open Source, Web Applications, Apache Cocoon}
web(log): http://www.poetz.cc --------------------------------------------------------------------