Having problems with your account or logging in?
A lot of changes are happening in the community right now. Some may affect you. READ MORE HERE

Memory Management and the StarTeam SDK

Memory Management and the StarTeam SDK

The SDK is a framework, not an application.

Memory allocated inside the SDK belongs to the owning application. It is the application responsibility to release that memory when done. Failure to do so will result in running out of memory (32 bit runtimes) or continuous page swapping (64 bit runtimes). In either case, the results aren't pleasant.

When an application connects and logs on to a StarTeam server using the SDK Server object, and the connect/logOn api's, the SDK creates an internal cache, which is shared across all in-memory server object instances connected to the same physical StarTeam server (hostname, port) endpoint. 

As applications work with projects and their views, the cache fills up with data, which stays in memory until the cache is destroyed, (all server instances referencing the cache are disconnected) or earlier, if the data itself is discarded by well behaved applications.

The view is the most granular container of cache data. As an example, if a view is queried for folders, files and change requests, and each of these types are then queried for all the property values of each of their instances, all the data associated with each instance of each type is mapped to the owning view in the cache.

Applications that iterate through several views, possibly across several projects, end up aggregating all the data associated with each view in memory, unless they explicitly request the cache to discard the data. The way to do this, is to close the view, using the api view.close()

The documentation for view.close() is copied below...

/**
* Frees all cached resources associated with this view, and closes the
* associated view session.
* <p>
* Many view-related resources, such as the folder tree, item lists and so
* on, can be discarded separately. Others, however, are freed only by an
* explicit call to close().
* <p>
* After a view is closed, the view object is still useful. The view session
* is automatically re-opened when needed, and data is re-fetched from the
* server on demand.
*
*/
public void View::close() {...}

Two SDK classes that are also of interest are ViewPollingAgent and ViewConfigurationDiffer.

These classes internally allocate a View, based on a specific rolled back configuration.

Applications that use either of these two classes are responsible for calling the close() method, which in turn ensures that internally allocated views are closed.

Well behaved applications will choose to call close() explicitly when done with a view (or view polling agent or view configuration differ) and not wait for a finalizer to kick in. View.close() should not be programmed into class finalizers(), neither in java nor in c#, since the implementation issues a network call to the StarTeam server, requesting the server to discard the cached view session.

A combination of proper memory management in conjunction with optimized network (client-server) traffic will result in well behaved, scalable, SDK applications.

DISCLAIMER:

Some content on Community Tips & Information pages is not officially supported by Micro Focus. Please refer to our Terms of Use for more detail.
Version history
Revision #:
1 of 1
Last update:
‎2013-11-15 20:42
Updated by:
 
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.