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: Pre Compiled Headers


Thanks for the response.

>> * Is it possible to explicitly free garbage collected memory if i know i
>> will not be needing it any more
> 
> Yes, ggc_free.[1]
> 
> 1 - Some people think that all the savings you'd get from this aren't
> work the pain of doing it, if you have to track down any over zealous
> ggc_free calls.
> 

There is no "additional" pain in doing this as I have already
developed my code using manual malloc/free in such a way that i am
reasonably sure there are no leaks, or double free calls or the like.

In my code I have been allocating memory with a macro BJC_MALLOC() and
BJC_FREE() that have some wrapper code that makes sure i have no
memory leaks at the end of the program and also ensure that i dont try
and free un-allocated memory/free something more than once etc. I can
also use this system to track all memory allocations/deallocations in
a log file. If there are any allocation/deallocation problems it tells
me what file/line that has been done on. Most of my memory allocation
has been done in that "Array Class" anyway. So most of it is fairly
localized.

I think i will try to continue using the explicit free and i can then
later just simply define out calls to ggc_free if i decide to do so at
a later date.

Anyhow, I guess it is time to get my hands dirty with the GCC Garbage
Collector...


Thanks for the advice,
Brendon.


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