Opened 17 years ago

Closed 17 years ago

#63 closed task (fixed)

Sanity check for RefCount

Reported by: gavincramer Owned by: gavincramer
Priority: major Milestone: 3.3.0
Component: FDO API Version: 3.3.0
Severity: 3 Keywords:
Cc: External ID:

Description

For FDO objects that support reference-counting, there are no checks to make sure that the reference counts are valid. Such checks could catch the use of stale pointers before they can (significantly) corrupt the heap. Throwing an exception about memory management is a better outcome than allowing execution to proceed to a crash. This also makes debugging memory issues much easier. It won't catch all memory mismanagement, but a non-positive reference count is a fairly obvious condition to check.

Checks for non-positive reference counts should be added (at least in Debug mode) to several choice locations:

  • FdoIDisposable::Release
  • FdoArray::Release
  • FdoCollection::GetItem

Change History (4)

comment:1 by gavincramer, 17 years ago

Resolution: fixed
Status: newclosed

Changes applied. The checks are conditionally-compiled, enabled by the "_DEBUG" preprocessor symbol. The code of these methods are also one line per statement, making it easier to set breakpoints.

comment:2 by gavincramer, 17 years ago

Code drop was reviewed by Dan Stoica.

Log:

Revision: 2745 Author: gavincramer Date: 1:33:44 PM, Tuesday, April 24, 2007 Message: Ticket #63 Sanity check for RefCount


Modified : /trunk/Fdo/Unmanaged/Inc/Common/Array.h Modified : /trunk/Fdo/Unmanaged/Inc/Common/Collection.h Modified : /trunk/Fdo/Unmanaged/Inc/Common/IDisposable.h

comment:3 by gavincramer, 17 years ago

Resolution: fixed
Status: closedreopened

comment:4 by gavincramer, 17 years ago

Resolution: fixed
Status: reopenedclosed

Fix build error...

Reviewed by: Brent Robinson

Log:

Revision: 2747 Author: gavincramer Date: 10:41:33 AM, Wednesday, April 25, 2007 Message: Ticket #63 Sanity check for RefCount


Modified : /trunk/Utilities/SchemaMgr/Inc/Sm/NamedCollection.h

Note: See TracTickets for help on using tickets.