[GRASS-dev] Improving the G_calloc: unable to allocate xx bytes of memory message?

Radim Blazek radim.blazek at gmail.com
Thu Nov 6 00:27:53 PST 2014


On Thu, Nov 6, 2014 at 8:59 AM, Glynn Clements <glynn at gclements.plus.com> wrote:
>
> Radim Blazek wrote:
>
>> > +++ include/Make/Compile.make   (working copy)
>>
>> > +ALL_CFLAGS = $(LFS_CFLAGS) $(EXTRA_CFLAGS) $(NLS_CFLAGS) $(DEFS) $(EXTRA_INC) $(INC) -DRELDIR=\"$(RELDIR)\"
>>
>> > +#define G_malloc(n)     G__malloc(RELDIR "/" __FILE__, __LINE__, (n))
>> > +#define G_calloc(m, n)  G__calloc(RELDIR "/" __FILE__, __LINE__, (m), (n))
>> > +#define G_realloc(p, n) G__realloc(RELDIR "/" __FILE__, __LINE__, (p), (n))
>>
>> With RELDIR defined in Grass.make it is impossible to compile anything
>> with GRASS libs without GRASS build system. Could you please add the
>> RELDIR definition to some header file?
>
> $(RELDIR) is just $(CURDIR) minus $(GRASS_HOME):
>
>         RELDIR          := $(subst $(GRASS_HOME)/,,$(CURDIR))
>
> Like $(CURDIR), it's different for each subdirectory, so it's not
> something which can be put into a header file.
>
> However, it's also not used for anything other than error messages, so
> compiling with e.g. -DRELDIR= or -DRELDIR=\"$(CURDIR)\" is safe.
>
> I've added a fallback in r62632.

Thanks
Radim

> --
> Glynn Clements <glynn at gclements.plus.com>


More information about the grass-dev mailing list