The Workflow Designer supports activities that are represented by real .NET types. That is why the Workflow Module creates a new .NET type for each designed activity. The dynamic assembly which resides in memory and provides persistent activities for the designer is recompiled each time the designer is started. The dynamic assembly is loaded in the application domain, and the memory occupied by the assembly can be released only when the application is closed (in .NET, each compiled type remains in memory until the application is restarted). However, this behavior is unnecessary when all of your runtime activities are built based on compiled WF activities, and there are no reused runtime activities. In this scenario, you can disable the persistent activities recompilation and, consequently, reduce memory consumption.
Mobile applications do not support the Workflow Module, so the approach described in this topic cannot be implemented in the Mobile platform.
A complete sample project is available in the DevExpress Code Examples database at http://www.devexpress.com/example=E4485.
Rebuild your solution after making changes in the designer.
Inherit the XpoWorkflowDefinition persistent class (requires a Devexpress.ExpessApp.Workflow.v.v18.2.dll reference). In your custom descendant, override the CanCompileForDesigner property so that it always returns false.
Rebuild your solution. Run the Model Editor and navigate to the Views | MyWorkflowDefinition_DetailView | Layout node. Adjust the layout to make it similar to the base class' layout (i.e., make the required base class' properties visible). The image below illustrates this customization.
Return to the Application Designer. In the designer's Modules pane, focus the WorkflowModule component. In the Properties window, set the WorkflowModule.WorkflowDefinitionType property to MyWorkflowDefinition.
Now you can check the result. Run the application to see that runtime activities are not added to the Workflow Designer toolbox. As the result, the application requires less memory.
In contrast to this simple example, a real-world application will additionally include the Workflow Server Service. So, you should specify the same workflow definition type on the server side. This can be done in the OnStart method declared in the WorkflowServerService.cs (WorkflowServerService.vb), after the WorkflowServer object is instantiated.