#708 closed defect (fixed)
Reference counters for "views"
| Reported by: | Paul Price | Owned by: | |
|---|---|---|---|
| Priority: | high | Milestone: | |
| Component: | types | Version: | unspecified |
| Severity: | normal | Keywords: | |
| Cc: |
Description
After some umm-ing and ah-ing, we have converged on a blanket policy with regard
to "views" of pointers. This policy is to be applied to all the "types" in
psLib that act as collections (psArray, psList, psHash, psMetadata).
Retrieving a pointer from a collection (e.g., psListGet, psMetadataLookup) shall
*not* increment the reference counter. The reason for this is the reduced
efficiency that comes from the increased hits on the memory management system
(especially the need to lock the mutex when working with multiple threads, as is
becoming an increasingly likely mode of operation). That is, we suffer by the
extra calls to psMemIncrRefCounter and psFree which would be required.
This does mean that we will have to be a bit more careful (e.g., of dangling
pointers --- pointers to something that has already been freed) than we would if
we went with the cautious option of having views increment the reference counter.
Functions that must be updated:
psArrayGet --- don't increment before returning
And I think that's it.
Change History (7)
comment:1 by , 20 years ago
| Owner: | changed from to |
|---|
comment:2 by , 20 years ago
It shouldn't be too hard --- remove the psMemIncrRefCounter at the end of
psArrayGet, and look for all usages of psArrayGet elsewhere in the code and
remove the associated psFree.
comment:3 by , 20 years ago
| blocked: | → 717 |
|---|
comment:4 by , 20 years ago
| Owner: | changed from to |
|---|
comment:5 by , 20 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
removed psMemIncrRefCounter from psArrayGet. Removed corresponding psFree's.

Robert, can you look at this and tell me who is best suited to working on it?