Implement `calloc{,Bytes,Array,Array0}` allocators

Edward Kmett ekmett at gmail.com
Sat Nov 29 16:14:39 UTC 2014


+1, 'nuff said.

I was very surprised they weren't already there, and calloc can be 2x
faster than any malloc/set to 0 nonsense.

-Edward

On Sat, Nov 29, 2014 at 11:05 AM, Oleksandr Petrov <
oleksandr.petrov at gmail.com> wrote:

> Hi everyone,
>
> There is a proposal [1] (with implemented revision) to implement zero-initialising
> versions
> of malloc{,Bytes,Array,Array0}
>
>    - Add calloc and callocBytes to Foreign.Marshal.Alloc.
>    - Add callocArray and callocArray0 to Foreign.Marshal.Array.
>
> The benefit is that you can allocate required amount of memory and be
> certain that it will be cleared
> (set with zeroes) before you use it. Original discussion took a place in
> `fillBytes` [1] and was
> publicised on that mailing list [2].
>
> Please share your thoughts.
>
> Thank you.
>
> [1] https://phabricator.haskell.org/D527
> [2] https://phabricator.haskell.org/D461#11541
> [3] https://www.haskell.org/pipermail/libraries/2014-November/024251.html
>
>
>
>
> --
> alex p
>
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://www.haskell.org/mailman/listinfo/libraries
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/libraries/attachments/20141129/3c22bc1e/attachment.html>


More information about the Libraries mailing list