[Fwd: Re: [GRASS-dev] r.colors: rules file list unsorted]

Paul Kelly paul-grass at stjohnspoint.co.uk
Sun Jan 28 17:37:24 EST 2007



On Mon, 29 Jan 2007, Wolf Bergenheim wrote:

>> or another way:  should we keep malloc()+free() separate from
>> G_malloc()+G_free()? ie don't mix the two?
>> 
>
> Isn't G_free just a wrapper for free, so that programmers don't need to worry 
> about linking with correct allocation libraries, and including headers which 
> vary on some UNIX platforms?

According to the programmers manual:


"The following routines provide memory allocation capability. They are 
simply calls to the UNIX suite of memory allocation routines malloc( ), 
realloc( ) and calloc( ), except that if ther is not enough memory, they 
print a diagnostic message to that effect and then call exit( ).
Note. Use the G_free( ) routine to release memory allocated by these 
routines."

So in practice they are the same, but I think it is cleaner programming 
and safer in the long run not to mix malloc() with G_free() etc.

Paul




More information about the grass-dev mailing list