Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 294992 Details for
Bug 432926
gs gets stuck in the garbage collector when interpreting certain files
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
patch backported to ghostscript-7.07-33
ghostscript-7.07-mem.patch (text/plain), 5.18 KB, created by
David Robinson
on 2008-02-15 07:35:18 UTC
(
hide
)
Description:
patch backported to ghostscript-7.07-33
Filename:
MIME Type:
Creator:
David Robinson
Created:
2008-02-15 07:35:18 UTC
Size:
5.18 KB
patch
obsolete
>--- ghostscript-7.07/src/gsalloc.c.dr 2003-01-17 10:49:02.000000000 +1000 >+++ ghostscript-7.07/src/gsalloc.c 2008-02-15 16:44:54.000000000 +1000 >@@ -812,8 +820,19 @@ > { > gs_ref_memory_t * const imem = (gs_ref_memory_t *)mem; > byte *str; >+ /* >+ * Cycle through the chunks at the current save level, starting >+ * with the currently open one. >+ */ >+ chunk_t *cp_orig = imem->pcc; > >-top:if (imem->cc.ctop - imem->cc.cbot > nbytes) { >+ if (cp_orig == 0) { >+ /* Open an arbitrary chunk. */ >+ cp_orig = imem->pcc = imem->cfirst; >+ alloc_open_chunk(imem); >+ } >+top: >+ if (imem->cc.ctop - imem->cc.cbot > nbytes) { > if_debug4('A', "[a%d:+> ]%s(%u) = 0x%lx\n", > alloc_trace_space(imem), client_name_string(cname), nbytes, > (ulong) (imem->cc.ctop - nbytes)); >@@ -821,6 +840,18 @@ > gs_alloc_fill(str, gs_alloc_fill_alloc, nbytes); > return str; > } >+ /* Try the next chunk. */ >+ { >+ chunk_t *cp = imem->cc.cnext; >+ >+ alloc_close_chunk(imem); >+ if (cp == 0) >+ cp = imem->cfirst; >+ imem->pcc = cp; >+ alloc_open_chunk(imem); >+ if (cp != cp_orig) >+ goto top; >+ } > if (nbytes > string_space_quanta(max_uint - sizeof(chunk_head_t)) * > string_data_quantum > ) { /* Can't represent the size in a uint! */ >@@ -1083,35 +1114,95 @@ > cp->cbot += asize; > ptr->o_alone = 1; > ptr->o_size = lsize; >- } else if (lsize > max_freelist_size && (flags & ALLOC_DIRECT) && >- (ptr = large_freelist_alloc(mem, lsize)) != 0) { >- /* We hadn't checked the large block freelist yet. */ >- --ptr; /* must point to header */ >- goto done; > } else { >+ /* >+ * Cycle through the chunks at the current save level, starting >+ * with the currently open one. >+ */ >+ chunk_t *cp_orig = mem->pcc; > uint asize = obj_size_round((uint) lsize); >- bool consolidate = mem->is_controlled; >- bool allocate_success = true; >+ bool allocate_success = false; >+ >+ if (lsize > max_freelist_size && (flags & ALLOC_DIRECT)) { >+ /* We haven't checked the large block freelist yet. */ >+ if ((ptr = large_freelist_alloc(mem, lsize)) != 0) { >+ --ptr; /* must point to header */ >+ goto done; >+ } >+ } > >- while (mem->cc.ctop - >- (byte *) (ptr = (obj_header_t *) mem->cc.cbot) >- <= asize + sizeof(obj_header_t)) { >- if (consolidate) { >+ if (cp_orig == 0) { >+ /* Open an arbitrary chunk. */ >+ cp_orig = mem->pcc = mem->cfirst; >+ alloc_open_chunk(mem); >+ } >+#define CAN_ALLOC_AT_END(cp)\ >+ ((cp)->ctop - (byte *) (ptr = (obj_header_t *) (cp)->cbot)\ >+ > asize + sizeof(obj_header_t)) >+ do { >+ if (CAN_ALLOC_AT_END(&mem->cc)) { >+ allocate_success = true; >+ break; >+ } else if (mem->is_controlled) { > /* Try consolidating free space. */ > gs_consolidate_free((gs_memory_t *)mem); >- consolidate = false; >- continue; >- } else { >- /* Add another chunk. */ >- chunk_t *cp = >- alloc_add_chunk(mem, (ulong)mem->chunk_size, "chunk"); >+ if (CAN_ALLOC_AT_END(&mem->cc)) { >+ allocate_success = true; >+ break; >+ } >+ } >+ /* No luck, go on to the next chunk. */ >+ { >+ chunk_t *cp = mem->cc.cnext; >+ >+ alloc_close_chunk(mem); >+ if (cp == 0) >+ cp = mem->cfirst; >+ mem->pcc = cp; >+ alloc_open_chunk(mem); >+ } >+ } while (mem->pcc != cp_orig); >+ >+#ifdef CONSOLIDATE_BEFORE_ADDING_CHUNK >+ if (!allocate_success) { >+ /* >+ * Try consolidating free space before giving up. >+ * It's not clear this is a good idea, since it requires quite >+ * a lot of computation and doesn't seem to improve things much. >+ */ >+ if (!mem->is_controlled) { /* already did this if controlled */ >+ chunk_t *cp = cp_orig; >+ >+ alloc_close_chunk(mem); >+ do { >+ consolidate_chunk_free(cp, mem); >+ if (CAN_ALLOC_AT_END(cp)) { >+ mem->pcc = cp; >+ alloc_open_chunk(mem); >+ allocate_success = true; >+ break; >+ } >+ if ((cp = cp->cnext) == 0) >+ cp = mem->cfirst; >+ } while (cp != cp_orig); >+ } >+ } >+#endif >+ >+#undef CAN_ALLOC_AT_END >+ >+ if (!allocate_success) { >+ /* Add another chunk. */ >+ chunk_t *cp = >+ alloc_add_chunk(mem, (ulong)mem->chunk_size, "chunk"); >+ >+ if (cp) { >+ /* mem->pcc == cp, mem->cc == *mem->pcc. */ >+ ptr = (obj_header_t *)cp->cbot; >+ allocate_success = true; >+ } >+ } > >- if (cp == 0) { >- allocate_success = false; >- break; >- } >- } >- } > /* > * If no success, try to scavenge from low free memory. This is only > * enabled for controlled memory (currently only async renderer) >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 432926
: 294992