#86 closed defect (fixed)
keeping psMemBlock elements around forever?
| Reported by: | Owned by: | eugene | |
|---|---|---|---|
| Priority: | high | Milestone: | |
| Component: | PSLib SDRS | Version: | unspecified |
| Severity: | normal | Keywords: | |
| Cc: |
Description
SDRS states, "In order to trace double frees and other memory errors, the memory
block reference is not automatically deleted when the associated memory is
deleted. Rather, the psMemBlock data and endpost data are left behind. If
endpost points to the memory location immediately following the psMemBlock data,
then the memory block has been freed. This state must be enforced by psFree."
This doesn't seem to be a real good idea, as this is nothing more than a
designed memory leak. If you delete the whole memory block, a second psFree
generally generates either a segmentation fault or a memory corruption
detection, which seems to be just as good of a detection means as a psAbort,
though not as friendly of an error message.
If this is a 'must have', I'd recommend that such functionality should be able
to be turned off, in the same manner as the tracing functionality, as compile time.
N.B. I've not implemented this feature yet. I'll await your input before doing
anything in this regard.
-rdd
Change History (5)
comment:1 by , 22 years ago
| op_sys: | Linux → All |
|---|---|
| rep_platform: | PC → All |
comment:2 by , 22 years ago
| Status: | new → assigned |
|---|
comment:3 by , 22 years ago
Sounds good; I'll use 'DEBUG' to signify if the psMemblock will be kept ad
infinitum.
Remember to change the SDRS.
comment:4 by , 22 years ago
| Resolution: | → fixed |
|---|---|
| Status: | assigned → closed |
comment:5 by , 22 years ago
i've defined the preprocessor name to be PS_MEM_DEBUG to fit our naming and make
it part of the memory stuff.

you are right about this as a planned memory leak. That doesn't make sense for
a production system. But, I think the utility is helpful for after-the-fact
analysis of the memory usage. Let's go with your suggestion of making this
feature something with is included on the basis of an ifdef at compile time.
something obvious like DEBUG or something equivalent would be good.