[Top][All Lists]

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

Re: [Discuss-gnuradio] aligned memory and posix_memalign

From: Tom Rondeau
Subject: Re: [Discuss-gnuradio] aligned memory and posix_memalign
Date: Sun, 6 Mar 2011 12:08:03 -0500

On Sun, Mar 6, 2011 at 9:48 AM, Don Ward <address@hidden> wrote:
A worrisome (to me) issue with the volk library is the use of posix_memalign() in the qa tests.  The worry is:

* posix_memalign() will never work on Windows with Microsoft's runtime library *

That means that code that uses posix_memalign won't work on Windows with MinGW or Microsoft native compilers.  (The problem is not that memory alignment is difficult; it is simply that there is no memory-aligned version of malloc() in the Microsoft API that works with free().)

At present, posix_memalign is used in GNU Radio in machine-dependent code (gcell, altivec, and arm7) and in the volk qa tests.  If we can replace it in volk and avoid its spread, we can continue to use GNU Radio on Windows.

One option is to use something like malloc16Align/free16Align (in malloc16.{h,c}) in gnuradio-core.  Can we structure the code to make this available in volk, and anywhere else it is needed?  We can add a version to do more general alignment if needed.  Would it help to wrap aligned buffers in a C++ class to make it easier to catch errors (such as using free() on a malloc16Align() buffer)?

Note that simply enhancing our own missing/posix_memalign function using _mingw_aligned_malloc() or Microsofts's _aligned_malloc() won't work because memory allocated with those cannot be released with free().

Trying not to cause too much trouble,

-- Don W.

Thanks for bringing this up. I'll look into it and we'll try to figure out a general solution for all platforms involved.



reply via email to

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