Re: Allocating aligned memory?

2006-03-09 Thread Simon Marlow
Li, Peng wrote: In GHC, how can I allocate a chunk of memory aligned to some block size (say, 512 or 1024 bytes)? I tried to specify it in the alignment method in the Storable typeclass, but that does not seem to work. Is Storable.alignment really used in GHC? If so, is there a code example that

Re: Allocating aligned memory?

2006-03-09 Thread Claus Reinke
For the moment I am using the C function memalign() like this: foreign import ccall static stdlib.h memalign :: CInt - CInt - IO (Ptr CChar) iirc, memalign is not provided on windows, nor by mingw. so this wouldn't be portable. claus Storable.alignment is not used, it is there for

Re: Allocating aligned memory?

2006-03-09 Thread Volker Stolz
* Li, Peng [EMAIL PROTECTED]: In GHC, how can I allocate a chunk of memory aligned to some block size (say, 512 or 1024 bytes)? I tried to specify it in the alignment method in the Storable typeclass, but that does not seem to work. Is Storable.alignment really used in GHC? If so, is there a

Allocating aligned memory?

2006-03-03 Thread Li, Peng
In GHC, how can I allocate a chunk of memory aligned to some block size (say, 512 or 1024 bytes)? I tried to specify it in the alignment method in the Storable typeclass, but that does not seem to work. Is Storable.alignment really used in GHC? If so, is there a code example that allocates aligned