Issue 1748: Memory Management for Value Factories Unspecified (obv-rtf) Source: (, ) Nature: Revision Severity: Summary: Summary: There are no rules governing how to free value factories in C++. Specifically, the ORB does not know what to do with the value factory at shutdown, and applications do not know what to do with the factory returned by register_value_factory. Directly deleting the factories may be hazardous (e.g. if they are shared across multiple valuetypes or even multiple ORBs), and leaving them around may introduce memory leaks. Resolution: Revised Text: Actions taken: July 28, 1998: received issue Discussion: End of Annotations:===== Return-Path: Sender: mmihic@iona.com Date: Tue, 28 Jul 1998 14:31:52 -0400 From: Matthew Mihic Organization: IONA Technologies, Inc. X-Accept-Language: en To: obv-rtf@omg.org, issues@omg.org Subject: Memory Management for Value Factories Unspecified There are no rules governing how to free value factories in C++. Specifically, the ORB does not know what to do with the value factory at shutdown, and applications do not know what to do with the factory returned by register_value_factory. Directly deleting the factories may be hazardous (e.g. if they are shared across multiple valuetypes or even multiple ORBs), and leaving them around may introduce memory leaks. Proposal: Introduce _add_ref/_remove_ref/_refcount methods to the ValueFactory class, with the following rules: 1. The ORB calls _add_ref on the factory when passed into register_value_factory. The previously registered factory is returned without modifying its reference count (i.e. ownership is transferred to the caller). The caller should _remove_ref when done with the returned factory. 2. The ORB calls _remove_ref on the previously registered factory on unregister_value_factory. 3. The ORB calls _remove_ref on all registered factories on shutdown. 4. The ORB calls _add_ref on the registered factory prior to returning it from a call to lookup_value_factory. The caller should _remove_ref when done with the returned factory. Regards, Matt -- Matthew A. Mihic IONA Technologies, Inc Phone: +1-617-949-4302 EMail: mmihic@iona.com