[Openmp-commits] [PATCH] D124652: [OpenMP] [OMPT] [amdgpu] [5/8] Implemented device init/fini/load callbacks

Dhruva Chakrabarti via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Wed Mar 22 09:52:06 PDT 2023


dhruvachak added inline comments.


================
Comment at: openmp/libomptarget/plugins-nextgen/common/OMPT/OmptCallback.cpp:32
+void OmptDeviceCallbacksTy::resize(int NumDevices) {
+  Devices = new OmptDeviceTy[NumDevices];
+}
----------------
mhalk wrote:
> jplehr wrote:
> > Potentially we should not allocate if `Devices` already holds a pointer, i.e., is not `nullptr`? This looks suspiciously as if we can leak memory here.
> Agreed. I'll simply send a DebugPrint when allocation failed.
> That is, when: zero or negative NumDevices were requested or when `Devices` was already allocated / non-nullptr.
Why not assert that Devices is nullptr before allocation?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D124652/new/

https://reviews.llvm.org/D124652



More information about the Openmp-commits mailing list