CLMALLOC(3)           Standard Compute Layer (CL) Manual           CLMALLOC(3)



NAME
       clmalloc,  clfree,  clsizeofmem - Allocate and free dynamic memory with
       CL bindings for use with co-processor devices

SYNOPSIS
       #include <stdcl.h>

       void* clmalloc( CONTEXT* cp, size_t size, int flags);

       void clfree( CONTEXT* cp, void* ptr);

       size_t clsizeofmem(void* ptr);

       Link with -lstdcl.

DESCRIPTION
       clmalloc() allocates memory suitable for sharing between compute  layer
       (CL)  co-processor  devices  within a CL context.  clmalloc() allocates
       size bytes and returns a pointer to the allocated memory.   The  memory
       is not cleared.  If size is 0, then clmalloc() returns a unique pointer
       value that can later be safely passed to clfree().

       clfree() frees the memory space pointed to by ptr, which must have been
       returned   by   a  previous  call  to  clmalloc().   Otherwise,  or  if
       clfree(ptr) has already been called before, the behavior is  undefined.
       It is considered an error to call clfree(ptr) if ptr is 0 or NULL.

       clsizeofmem()  returns the size of the allocated memory associated with
       ptr.  If ptr does not reference memory allocated by a  call  to  clmal-
       loc(),  and  for  which  clfree()  has not been called, the behavior is
       undefined.

RETURN VALUE
       If successful clmalloc(3) returns a pointer  to  the  allocated  memory
       that  is suitably aligned and suitable for sharing with CL co-processor
       devices.  On error, returns NULL.

       clfree() returns no value.

       clsizeofmem() returns the size in bytes of the  memory  pointed  to  by
       ptr.

AUTHOR
       Written by David Richie.

REPORTING BUGS
       Report bugs to <support@browndeertechnology.com>

COPYRIGHT
       Copyright  (C) 2009 Brown Deer Technology, LLC.  Licensed under the GNU
       Lesser General Public License version 3 (LGPLv3).  There is NO WARRANTY
       to the extent permitted by law.

SEE ALSO
       clmattach(3), clmdetach(3), clmsync(3), stdcl(3), malloc(3)




libstdcl-0.7                      2009-11-10                       CLMALLOC(3)