zif520 / opencl-book-samples

Automatically exported from code.google.com/p/opencl-book-samples
0 stars 0 forks source link

Errata: Miss-use of returned value from clGetContextInfo (ch.3, pg.88) #8

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
The code example on page 88 contains a miss-use of a returned value from a call 
to clGetContextInfo() with param_name = CL_CONTEXT_DEVICES. The returned 'size' 
is already the size of the cl_device_id[] that the next call would return, in 
bytes, yet the following allocation multiplies this value by 
sizeof(cl_device_id).

P.S.
As with a lot of examples in the book, releasing memory allocated for these 
such tasks is not denoted in the code, which leads to memory leaks.

P.P.S.
A lot of tables (e.g. 3.3, 3.4, 3.5) are missing a lot of border lines between 
rows. This is a cosmetic issue.

Original issue reported on code.google.com by wel...@gmail.com on 4 Aug 2011 at 2:15

Attachments:

GoogleCodeExporter commented 8 years ago
This is an over allocation since the size is already in bytes.  Ben, please fix 
in the code.

Original comment by dginsb...@upsamplesoftware.com on 6 Aug 2011 at 12:53