CLRETAINMEMOBJECT(3clc)

πŸ“¦
version 1.0~svn33624 Β· 3 versions
, in ubuntu jammy, ubuntu noble

πŸ’– CLRETAINMEMOBJECT πŸ’–

okay bestie, welcome to the OpenCL Manual page for clRetainMemObject β€” yes the manual name is literally baked into the title, we're keeping it, it's iconic πŸŽ€


✨ NAME ✨

clRetainMemObject β€” Increments the memory object reference count.

cl_int clRetainMemObject(cl_mem memobj);

like... it's giving "one more for the road" 🫢


🌸 PARAMETERS 🌸

  • memobj β€” A valid memory object. that's it. that's the whole vibe check. it has to be valid, bestie, we're not playing games πŸ’…

πŸ¦‹ NOTES πŸ¦‹

okay so listen, this is important:

clCreateBuffer(3clc), clCreateSubBuffer(3clc), and clCreateImage(3clc), and perform an implicit retain.

translation: those three already did the retaining for you, no cap. you didn't even have to ask πŸ‘‘

After the memobj reference count becomes zero and commands queued for execution on a command-queue(s) that use memobj have finished, the memory object is deleted. If memobj is a buffer object, memobj cannot be deleted until all sub-buffer objects associated with memobj are deleted.

lowkey this is the whole plot: count hits zero ➑️ wait for the queued commands to finish ➑️ then it's deleted. and if memobj is a buffer object? it cannot be deleted until all sub-buffer objects associated with memobj are deleted. the sub-buffers hold the main character hostage fr 😭


πŸ”₯ ERRORS πŸ”₯

Returns CL_SUCCESS if the function is executed successfully. Otherwise, it returns one of the following errors:

  • CL_INVALID_MEM_OBJECT β€” if memobj is a not a valid memory object (buffer or image object). not me passing a fake memory object πŸ™ˆ
  • CL_OUT_OF_RESOURCES β€” if there is a failure to allocate resources required by the OpenCL implementation on the device. the device said no πŸ’€
  • CL_OUT_OF_HOST_MEMORY β€” if there is a failure to allocate resources required by the OpenCL implementation on the host. and now the host said no 😭

πŸ“œ SPECIFICATION πŸ“œ

OpenCL Specification[1]


πŸ‘€ SEE ALSO πŸ‘€

go read those too, iykyk 🌈


πŸ’œ AUTHORS πŸ’œ

The Khronos Group


Copyright Β© 2007-2011 The Khronos Group Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and/or associated documentation files (the "Materials"), to deal in the Materials without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Materials, and to permit persons to whom the Materials are furnished to do so, subject to the following conditions:

wait, bestie, the original said "subject to the condition that this copyright notice and permission notice shall be included in all copies or substantial portions of the Materials." β€” so here it is, in full, keeping every word:

the condition is: this copyright notice and permission notice shall be included in all copies or substantial portions of the Materials. periodt πŸ’…


πŸ“Ž NOTES πŸ“Ž (the footnote ones)

  1. OpenCL Specification β€” page 118, section 5.4.1 - Retaining and Releasing Memory Objects

and that's the whole page, bestie!! written by The Khronos Group, dated 01/14/2021, and it's the CLRETAINMEMOBJECT(3clc) page from the OpenCL Manual ✨ you ate that πŸ«ΆπŸ’–

πŸ“¦ where this page comes from