This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: thanks for the memory work
- From: law at redhat dot com
- To: Daniel Berlin <dberlin at dberlin dot org>
- Cc: Jan Hubicka <hubicka at ucw dot cz>, Andrew MacLeod <amacleod at redhat dot com>, Steven Bosscher <s dot bosscher at student dot tudelft dot nl>, gcc mailing list <gcc at gcc dot gnu dot org>
- Date: Wed, 26 Nov 2003 11:40:51 -0700
- Subject: Re: thanks for the memory work
- Reply-to: law at redhat dot com
In message <DD38C870-2017-11D8-810E-000A95DA505C@dberlin.org>, Daniel Berlin wr
ites:
>>
>>> Try to count the number of times the array is grown (IE we don't get
>>> the size exactly right for the entire lifetime).
>>> Now, note the use of ggc_realloc in varray.c
>>>
>>> Then look at what ggc_realloc does in ggc-common.c.
>>>
>>> Now count the number of times the array is grown again, and cry.
>> And this is a surprise in what way?
>
>That a varray generate O(n) garbage every time it's resized if it's
>ggc_allocated,
Which is precisely what I would expect it to do.
> but doesn't if it's non-ggc allocated?
More correctly if it is not GC allocated, then the original memory is
immediately available for re-use by malloc.
>No need for a new data structure, you just need a better GC system that
>lets you say that some memory is now completely free.
Which is precisely what I have stated we need as well.
jeff