help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: R: invoking the correct memory management from C files


From: Riccardo Corradini
Subject: Re: R: invoking the correct memory management from C files
Date: Wed, 5 May 2010 14:53:43 +0000 (GMT)

>>Should I just declare ltfat_free to be empty, or is there a better
>>solution?
No, you should not. OCTAVE_LOCAL buffer does all the job
>>Does OCTAVE_LOCAL_BUFFER allocate memory starting a 16 bytes boundaries
(like fftw_malloc) in order to improve performance (both FFTW and ATLAS
can take advantage of this)?
I really don't know.
Bests
Riccardo


--- Mer 5/5/10, Peter L. Soendergaard <address@hidden> ha scritto:

Da: Peter L. Soendergaard <address@hidden>
Oggetto: Re: R: invoking the correct memory management from C files
A: "help-octave" <address@hidden>
Data: Mercoledì 5 maggio 2010, 16:02

ons, 05 05 2010 kl. 13:42 +0000, skrev Riccardo Corradini:
> Could you please show an example?
>
>
>

I my C-library the code typically looks something like this:

void dgtreal_long(....)
{
   LTFAT_COMPLEX *gf = ltfat_malloc(L*sizeof(LTFAT_COMPLEX));

   .. do stuff ...
 
   ltfat_free(gf);
}

If I build it as a standalone library, ltfat_malloc and Ltfat_free are
given by:

void* ltfat_malloc (size_t n)
{
  return fftw_malloc(n);
}

void ltfat_free(void *ptr)
{
  fftw_free(ptr);
}

For Octave I would like to define ltfat_malloc as something like (not
tested!):

void* ltfat_malloc (size_t n)
{
  OCTAVE_LOCAL_BUFFER (unsigned char, tmp, n);
  return tmp;
}

Should I just declare ltfat_free to be empty, or is there a better
solution?

Does OCTAVE_LOCAL_BUFFER allocate memory starting a 16 bytes boundaries
(like fftw_malloc) in order to improve performance (both FFTW and ATLAS
can take advantage of this)?

I tried looking at src/mex.cc but it did not make me any wiser.

Cheers,

Peter.

_______________________________________________
Help-octave mailing list
address@hidden
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave


reply via email to

[Prev in Thread] Current Thread [Next in Thread]