To ensure compatibility with the RI, In JSF 2.1, markInitialState() call is done after the component tree is built with a visitTree() call. That works fine, but in JSF 2.0 or when you have a dynamic content inside a page, it is necessary to activate markInitialState() call through facelet algorithm as described in
The concept works very good, but I notice a side effect in vdl.retargetAttachedObjects() and vdl.retargetMethodExpressions(). Since markInitialState() call goes from leaf to the root, and these methods traverse the tree to apply changes in child components, all changes done by these two methods are stored into the "delta" part of the state.
Since vdl.retargetAttachedObjects() and vdl.retargetMethodExpressions() are called in build view time and only when the composite component is created, it is safe to check if pss is used in the view and markInitialState() algorithm has been activated, to call markInitialState() over the child components (the call for the top level component is done in the outside). Maybe it will be some extra calls to markInitialState() for the same component, but it is worth to do it, because this call is very fast, and the effect is get a zero (or almost zero) state size overhead for composite components.
Additionally, it is better in this case to use these classes:
to ensure no state is stored in these cases. Note this issue is the solution to the problem described in