[m-rev.] diff: Fix collection of memory zones.

Julien Fischer juliensf at csse.unimelb.edu.au
Wed Nov 23 22:20:53 AEDT 2011


On Wed, 23 Nov 2011, Paul Bone wrote:

>
> Branches: main, 11.07
>
> Add code that was missing from the code that collects unused zones from the
> zone free list.  This corrects a bug that may cause memory to be retained
> indefinitely.
>
> runtime/mercury_memory_zones.c:
>    As above
>
> Index: runtime/mercury_memory_zones.c
> ===================================================================
> RCS file: /home/mercury1/repository/mercury/runtime/mercury_memory_zones.c,v
> retrieving revision 1.42
> diff -u -p -b -r1.42 mercury_memory_zones.c
> --- runtime/mercury_memory_zones.c	26 Oct 2011 14:08:45 -0000	1.42
> +++ runtime/mercury_memory_zones.c	23 Nov 2011 10:32:11 -0000

...

> +        zone = lru_free_memory_zones->MR_zonesfree_minor_head;
> +        prev_zone = NULL;
> +        MR_assert(NULL != zone);
> +        while(NULL != zone)
> +        {
> +            if (zone == lru_free_memory_zones->MR_zonesfree_minor_tail) {
> +                break;
> +            }
> +
> +            prev_zone = zone;
> +            zone = zone->MR_zone_next;
> +        }
> +        MR_assert(NULL != zone);
> +
> +        /*
> +         * Unlink zone from the free list.
> +         */
> +        if (prev_zone == NULL) {
> +            /*
> +             * The list that contained zone is now free, unlink it from it's list.

s/it's/its/

Julien.
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list