As described in the overview chapter, the Scenarios module creates transient states for every visitor passing through a scenario and stores information about those states in the profile repository. In the case of scenarios that contain fork elements, the Scenarios module creates a state for every possible path a visitor could follow through a fork. If you have a large number of site visitors, and you create fork elements that present many possible paths, out-of-memory errors can occasionally occur.

For this reason, design fork elements carefully so that you minimize the number of possible paths the fork can contain. One way to do this is by reducing the number of branches that start with events. In the following example, a series of branches start with a Visits element:

Rewrite scenarios such as this one by placing the event before the fork, and then specifying the page in a series of condition elements after the fork:

loading table of contents...