57 lines
2.3 KiB
Diff
57 lines
2.3 KiB
Diff
commit 46809ccf0281e7556e55f50f25ad5c811fad6ba3
|
|
Author: philippe <philippe@a5019735-40e9-0310-863c-91ae7b9d1cf9>
|
|
Date: Sun Feb 14 22:14:19 2016 +0000
|
|
|
|
Fix Bug 359133 - m_deduppoolalloc.c:258 (vgPlain_allocEltDedupPA): Assertion 'eltSzB <= ddpa->poolSzB' failed.
|
|
|
|
When the elt to allocate is bigger than the pool size, allocate
|
|
a specific pool only for this element.
|
|
|
|
|
|
|
|
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15787 a5019735-40e9-0310-863c-91ae7b9d1cf9
|
|
|
|
diff --git a/coregrind/m_deduppoolalloc.c b/coregrind/m_deduppoolalloc.c
|
|
index 92016d8..f7ebd27 100644
|
|
--- a/coregrind/m_deduppoolalloc.c
|
|
+++ b/coregrind/m_deduppoolalloc.c
|
|
@@ -255,7 +255,6 @@ const void* VG_(allocEltDedupPA) (DedupPoolAlloc *ddpa, SizeT eltSzB,
|
|
ht_node *ht_ins;
|
|
vg_assert(ddpa);
|
|
vg_assert(ddpa->ht_elements);
|
|
- vg_assert (eltSzB <= ddpa->poolSzB);
|
|
|
|
ddpa->nr_alloc_calls++;
|
|
|
|
@@ -272,15 +271,24 @@ const void* VG_(allocEltDedupPA) (DedupPoolAlloc *ddpa, SizeT eltSzB,
|
|
and insert it in the hash table of inserted elements. */
|
|
|
|
// Add a new pool or grow pool if not enough space in the current pool
|
|
- if (UNLIKELY(ddpa->curpool_free == NULL
|
|
- || ddpa->curpool_free + eltSzB - 1 > ddpa->curpool_limit)) {
|
|
- ddpa_add_new_pool_or_grow (ddpa);
|
|
+ if (eltSzB + ddpa->eltAlign > ddpa->poolSzB) {
|
|
+ // Element (+eltAlign for worst case) bigger than the pool size
|
|
+ // => allocate a specific pool just for this element
|
|
+ UChar *newpool = ddpa->alloc_fn (ddpa->cc, eltSzB + ddpa->eltAlign);
|
|
+ /* add to our collection of pools */
|
|
+ VG_(addToXA)( ddpa->pools, &newpool );
|
|
+ elt_ins = ddpa_align (ddpa, newpool);
|
|
+ } else {
|
|
+ if (UNLIKELY(ddpa->curpool_free == NULL
|
|
+ || ddpa->curpool_free + eltSzB - 1 > ddpa->curpool_limit)) {
|
|
+ ddpa_add_new_pool_or_grow (ddpa);
|
|
+ }
|
|
+ elt_ins = ddpa->curpool_free;
|
|
+ ddpa->curpool_free = ddpa_align(ddpa, ddpa->curpool_free + eltSzB);
|
|
}
|
|
|
|
- elt_ins = ddpa->curpool_free;
|
|
- VG_(memcpy)(elt_ins, elt, eltSzB);
|
|
- ddpa->curpool_free = ddpa_align(ddpa, ddpa->curpool_free + eltSzB);
|
|
|
|
+ VG_(memcpy)(elt_ins, elt, eltSzB);
|
|
ht_ins = VG_(allocEltPA) (ddpa->ht_node_pa);
|
|
ht_ins->key = ht_elt.key;
|
|
ht_ins->eltSzB = eltSzB;
|