Opened 18 years ago
Closed 18 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 , 18 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:2 by , 18 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 , 18 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
comment:4 by , 18 years ago
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
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.