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: precompiled header support


> -----Original Message-----
> From: Gunther Nikl 
> Sent: 12 May 2004 08:55

> > when you know you have to free every malloc because it 
> won't get released
> > just because your process exits!).
 
>   That not quite correct. Allocations done through standard C 
> functions
>   (memory, streams) _are_ released as long as the progam 
> doesn't bypass
>   the cleanup step (eg. by calling _exit()). Its true that 
> direct resource
>   allocations with OS functions need to be freed explicitly 
> because there
>   is no resource tracking per process.


Heh, sorry for being slightly vague about it; of course I knew that, but
since the C library isn't an OS component but an addon under Amiga, I think
it's fair to say that your objection is pretty much the same as saying "You
don't have to remember to free every allocation, you just need to allocate
one block and remember to free it once, then use your own heap manager
routines within that block".  I guess I shouldn't have used the word
'malloc' when I really meant 'memory allocation'; but bear in mind that even
if you want to say I should be comparing malloc with malloc, then remember
that sbrk'd space also gets freed automatically at process exit and
AllocMem'd space doesn't, so my point still stands!


    cheers, 
      DaveK
-- 
Can't think of a witty .sigline today....


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