This issue occurs if the session memory cannot allocate graphical user interface (GUI) objects to applications.
The session memory in a terminal server session manages the allocation of GUI objects to different applications. If the session memory that is assigned to GUI objects is not sufficient, GUI objects will not be correctly allocated to applications that run on the Terminal server. This may cause applications not to run correctly.
It is possible to increase the limit of the GDI-objects allowed http://msdn.microsoft.com/en-us/library/windows/desktop/ms725486(v=VS.85).aspx
However, this is a windows operating system limit and if the issue is caused by GDI-objects that are not released when the form is closed then increasing this limit is only temporary.
To troubleshoot this issue refer to the below blogs. To monitor the memory and GDI-object usage you can use Process Monitor and WinObj as described in the blogs: