Releasable

scalacv.Releasable
See theReleasable companion trait
object Releasable

Attributes

Companion
trait
Source
Releasable.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Releasable.type

Members list

Value members

Concrete methods

def handle[A <: AnyRef](getNativeAddr: A => Long): Releasable[A]

The fallback for the other 185 types: a cached MethodHandle onto the binding's private delete(long).

The fallback for the other 185 types: a cached MethodHandle onto the binding's private delete(long).

This is deliberately opt-in and loud. delete(long) is private API with no compatibility promise, and setAccessible stops working the moment OpenCV's classes are loaded from a named module rather than the classpath — which a consumer controls via --add-opens, and we cannot. So handle never degrades silently: if the bridge cannot be opened it throws, because the alternative is an unbounded leak that looks like success.

Attributes

Source
Releasable.scala

Givens

Givens

Mat frees through release(), which drops the reference to the pixel buffer at once — the multi-megabyte allocation that actually costs memory. The small (~100 B) cv::Mat header is not freed here; it is reclaimed by the inherited CleanableMat.finalize() whenever the collector next runs.

Mat frees through release(), which drops the reference to the pixel buffer at once — the multi-megabyte allocation that actually costs memory. The small (~100 B) cv::Mat header is not freed here; it is reclaimed by the inherited CleanableMat.finalize() whenever the collector next runs.

We deliberately do not route Mat through the delete(long) bridge the other 185 types use: Mat exposes no accessible delete(long) — only its superclass's private CleanableMat.n_delete — and the header is too small for reflection to reclaim it a little sooner to be worth the cost. The buffer, which is the part that matters, is already gone the instant release() returns.

Attributes

Source
Releasable.scala

Attributes

Source
Releasable.scala

Attributes

Source
Releasable.scala