mirror of
https://sourceware.org/git/glibc.git
synced 2025-09-02 16:01:20 +03:00
* nscd/mem.c (gc): Correctly determine highest used array element
in mark.
This commit is contained in:
@@ -1,5 +1,8 @@
|
|||||||
2008-05-17 Ulrich Drepper <drepper@redhat.com>
|
2008-05-17 Ulrich Drepper <drepper@redhat.com>
|
||||||
|
|
||||||
|
* nscd/mem.c (gc): Correctly determine highest used array element
|
||||||
|
in mark.
|
||||||
|
|
||||||
* nscd/mem.c (markrange): Add assert to check entries are all
|
* nscd/mem.c (markrange): Add assert to check entries are all
|
||||||
aligned. Small cleanup in bitmap use.
|
aligned. Small cleanup in bitmap use.
|
||||||
|
|
||||||
|
@@ -131,8 +131,8 @@ gc (struct database_dyn *db)
|
|||||||
size_t stack_used = sizeof (bool) * db->head->module;
|
size_t stack_used = sizeof (bool) * db->head->module;
|
||||||
if (__builtin_expect (stack_used > MAX_STACK_USE, 0))
|
if (__builtin_expect (stack_used > MAX_STACK_USE, 0))
|
||||||
stack_used = 0;
|
stack_used = 0;
|
||||||
size_t memory_needed = ((db->head->first_free / BLOCK_ALIGN + BITS - 1)
|
size_t nmark = (db->head->first_free / BLOCK_ALIGN + BITS - 1) / BITS;
|
||||||
/ BITS) * sizeof (BITMAP_T);
|
size_t memory_needed = nmark * sizeof (BITMAP_T);
|
||||||
if (stack_used + memory_needed <= MAX_STACK_USE)
|
if (stack_used + memory_needed <= MAX_STACK_USE)
|
||||||
{
|
{
|
||||||
mark = (BITMAP_T *) alloca (memory_needed);
|
mark = (BITMAP_T *) alloca (memory_needed);
|
||||||
@@ -234,7 +234,7 @@ gc (struct database_dyn *db)
|
|||||||
qsort (he, cnt, sizeof (struct hashentry *), sort_he);
|
qsort (he, cnt, sizeof (struct hashentry *), sort_he);
|
||||||
|
|
||||||
/* Determine the highest used address. */
|
/* Determine the highest used address. */
|
||||||
size_t high = sizeof (mark);
|
size_t high = nmark;
|
||||||
while (high > 0 && mark[high - 1] == 0)
|
while (high > 0 && mark[high - 1] == 0)
|
||||||
--high;
|
--high;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user