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



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, but doesn't if it's non-ggc allocated?



Without a completely new set of data structures this is exactly what I would expect when I don't know how big of an array I'm going to need.

Uh, it doesn't happen if it's not ggc-allocated.
Thus, i wouldn't expect it to happen if it was.
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.



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