[gs-bugs] [Bug 690346] many pcl files from the customer test file directory have problems.

bugs.ghostscript.com-bugzilla-daemon at ghostscript.com bugs.ghostscript.com-bugzilla-daemon at ghostscript.com
Tue Mar 31 22:52:50 PDT 2009


http://bugs.ghostscript.com/show_bug.cgi?id=690346





------- Additional Comments From ray.johnston at artifex.com  2009-03-31 22:52 -------
Thanks to Henry for identifying that the memory accumulation was due to 'lost'
strings. The 'ialloc' manager only recovers the space when the string being
freed is immediately adjacent to the 'ctop' of the chunk. The gs_nogc_reclaim
has the side effect of replacing the alloc_string, free_string and consolidate_
free procs with "smarter" versions that are better at recovering the space of
strings that are not immediately adjacent to the ctop.

The chunk memory manager does not have the defect that the ialloc does, since
strings are treated the same as other elements and are immediately added to
the free list of the chunk, annealing adjacent free spaces as needed.

The allocation pattern that caused this persists and with PostScript (or
PDF) this type of file causes accumulation of space. Setting the vmthreshold
to a large number exhibits the growth. The sequence of allocation/free that
causes the problem is attributed to the gxclrast.c read_set_color_space
when the color space is 'Indexed'. The palette table is allocated as a string,
but if the previous color space was also Indexed, its table was not freed
until AFTER the new table was allocated, so the the free_string was not
adjacent to ctop, thus 'losing' the string free space with the ialloc manager
until a GC happened.

I changed the 'read_set_color_space' function to rc_decrement the old color
space BEFORE allocating the new one and with the gs_nogc_reclaim code removed
in pl/plmain.c, the memory growth is gone and the file completes to ppmraw
600 dpi in 67 sec. Since the current svn code completes in the same time,
there is no performance disadvantage to running the nogc string functions
with the 39002wts.pcl file.

I will perform regression testing on the gxclrast.c change and commit it if
it looks OK since it will help PS files which use the 'stock' ialloc string
methods.




------- You are receiving this mail because: -------
You are the QA contact for the bug, or are watching the QA contact.



More information about the gs-bugs mailing list