plfiorini / opencl-book-samples

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

Errata: Memory leak in example code (ch3. pg.67) #7

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Listing 3.2 on page 67 contains a memory leak, with internally allocated memory 
for the platform information not being released.

See attached file for code snippet.

P.S.
I realize that this isn't the focus of the example code, however it is still an 
errata. If these types of issue reports are of no need, please let me know.

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

Attachments:

GoogleCodeExporter commented 8 years ago
This is indeed a memory leak.  Ben, there are a number of these leaks in 
OpenCLInfo.cpp, please fix.  Thanks.

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

GoogleCodeExporter commented 8 years ago

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

GoogleCodeExporter commented 8 years ago
Is this really a memory leak?  If you use alloca() to allocate memory then that 
memory should be automatically deallocated upon return from the parent 
function.  If you used alloc() then that would be a memory leak.

Original comment by Sean.Set...@gmail.com on 19 Aug 2011 at 4:35

GoogleCodeExporter commented 8 years ago
Indeed - Sorry I didn't notice the 'a' at the end of 'alloca'. This issue can 
be closed.

Original comment by wel...@gmail.com on 19 Aug 2011 at 6:51

GoogleCodeExporter commented 8 years ago
I missed that too, closing.  Thanks.

Original comment by dginsb...@upsamplesoftware.com on 20 Aug 2011 at 7:42