This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: thanks for the memory work


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



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]