Bug 688333 - pointer stability bedlam
Summary: pointer stability bedlam
Status: RESOLVED WORKSFORME
Alias: None
Product: Ghostscript
Classification: Unclassified
Component: General (show other bugs)
Version: master
Hardware: PC Windows XP
: P3 normal
Assignee: Henry Stiles
URL:
Keywords: bountiable
Depends on:
Blocks:
 
Reported: 2005-10-12 04:12 UTC by leonardo
Modified: 2012-09-26 18:01 UTC (History)
1 user (show)

See Also:
Customer:
Word Size: ---


Attachments
stderr.txt (173.16 KB, text/plain)
2005-10-12 04:15 UTC, leonardo
Details

Note You need to log in before you can comment on or make changes to this bug.
Description leonardo 2005-10-12 04:12:52 UTC
After implementing a pointer stability validation in the garbager, got hundreds 
of error messages running any document. 

Note : the check is currently disabled with IGC_PTR_STABILITY_CHECK 0 in 
gxobj.h .

related to the bug 688226.
Comment 1 leonardo 2005-10-12 04:15:34 UTC
Created attachment 1716 [details]
stderr.txt

Attaching errors obtained with running "-r72 -dBATCH comparefiles\001-01.ps"
with display device - 883 messages total.
Comment 2 leonardo 2005-10-19 10:02:45 UTC
See also zmisc2.c ln 256.
Comment 3 Henry Stiles 2009-08-17 13:11:17 UTC
Much of the "bedlam" seems to be a result of the "bedlam" detector.  The
space_id is only initialized in alloc_obj() but objects can be returned from the
allocator in other ways (lifo, freelist) leaving this space id member
uninitialized then it can be erroneously reported on the list.  The code has to
be properly instrumented before going through the error list.
Comment 4 Henry Stiles 2009-08-18 08:13:15 UTC
There are currently many entries with the graphics state for example:

GPL Ghostscript SVN PRE-RELEASE 8.71: ./psi/ilocate.c(521): Reference to a less
stable object 0xa629ff4<gs_cie_render> in the space 'local' from
0xa72baa4<gs_state> in the space 'global' !

I am not going to look at these unless somebody knows why analysis is necessary.
 Adobe postscript does not treat the graphics state as an object in vm, we
allocate it in global vm and have elaborate memory management exceptions to
handle the gstate which I assume deal with the local references of the gstate,
drilling down into the that will be saved for a real bug.  

I did check the following works (doesn't create a dangling reference):

save

% make a color space in local vm

[ /CIEBasedABC 
<< /RangeABC [0.0  0.9505  0.0  1.0  0.0  1.0890] 
/RangeLMN [0.0  0.9505  0.0  1.0  0.0  1.0890] 
/WhitePoint [0.9505  1.0  1.0890] 
>> 
] setcolorspace 

% get rid of local vm.
restore

currentcolorspace


% pststack gives devicegray, the start up color space
Comment 5 Henry Stiles 2012-09-26 18:01:59 UTC
We probably should run the code with IGC_PTR_STABILITY_CHECK to see that we don't have memory problems, but I doubt the problems in this report (now 7 years old) are relevant any longer.