Main > Knowledge Base > Developer resources > Development recommendations > 1C:Enterprise script > Storing values in object and form module variables > Developer resources > Development recommendations > 1C:Enterprise script > Storing values in object and form module variables > Developer resources > Development recommendations > 1C:Enterprise script > Storing values in object and form module variables

Storing values in object and form module variables

The 1C:Enterprise platform implements the object lifetime management strategy based on reference counting. Each platform object has a reference counter. If a new reference to an object is created (the object is assigned to a variable), the counter is incremented by 1. If a reference is deleted, the counter is decremented by 1. Once the reference counter value becomes 0, the object is deleted and the memory allocated for the object is released.

This strategy allows the creation of circular references. A circular reference appears when objects reference each other. This leads to a situation when each of the objects that form a circular reference cannot be deleted. This, in turn, leads to memory leaks.

Avoid the creation of circular references whenever possible. Following simple rules during configuration development helps you avoid problems related to circular references. If a circular reference is created, define a moment for breaking it to ensure the deletion of the objects in a regular way.

It is impossible to name all situations that lead to circular references. Here are some examples:

Note that, in addition to references created by module variables, references to objects can be created when objects are passed to script methods. For example, adding a value list to itself (as one of the values) leads to a circular reference.

Next page: User interruption of module execution




© 1C LLC. All rights reserved
1C Company respects the privacy of our customers and visitors
to our Web-site.