          (deref ref#))
        Releaseable
        (release [this#]
-         (locking this#
+         (locking ref#
            (when-let [d# (deref ref#)]
              (locking d#
                (with-check (~release-method d#) (vreset! ref# nil)))))

    @cl)
  Releaseable
  (release [this]
    (locking this
      (when-let [c @cl]
        (locking c
          (with-check (CL/clReleaseMemObject c)

    @svm*)
  Releaseable
  (release [this]
    (locking svm*
      (when-let [ss @svm*]
        (locking ss
          (CL/clSVMFree ctx ss)
