tzimiskes / causality

Examine The Causal Structure of Data

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

memory allocation does not appear to be CRAN compliant.

tzimiskes opened this issue · comments

This may cause memory leaks when functions are interrupted. However, fixing this is low priority. This needs to be fixed before submitting to CRAN

I looked into this a bit, and I would say that on top of this, my error handing will have to include some way to account for all possible memory problems

Calloc is a MACRO which essentially uses this function.

void *R_chk_calloc(size_t nelem, size_t elsize)
{
    void *p;
#ifndef HAVE_WORKING_CALLOC
    if(nelem == 0)
	return(NULL);
#endif
    p = calloc(nelem, elsize);
    if(!p) /* problem here is that we don't have a format for size_t. */
	error(_("'Calloc' could not allocate memory (%.0f of %u bytes)"),
	      (double) nelem, elsize);
    return(p);
}

In other words, its a thin wrapper that is my opinion useless, because it triggers error handling, and thus I will have memory leaks

I need to look into R_checkUserInterrupt to see how that will cause memory leaks as well