WeakPointerScope
Stay organized with collections
Save and categorize content based on your preferences.
A minimalist pointer scope only keeping weak references to its elements.
As opposed to ERROR(/org.bytedeco.javacpp.PointerScope)
, instances of this class will not
prevent the garbage collector to free the memory of a pointer that is no longer reachable, even
if it has been attached to the scope.
When the scope is closed, all pointers that are still valid will be automatically deallocated
while those already garbage-collected will be ignored.
Public Methods
void
|
attach(Pointer pointer)
Attach a pointer to this scope.
|
synchronized
void
|
|
void
|
detach(Pointer pointer)
Detach a pointer from this scope.
|
Inherited Methods
From class
java.lang.Object
boolean
|
equals(Object arg0)
|
final
Class<?>
|
getClass()
|
int
|
hashCode()
|
final
void
|
notify()
|
final
void
|
notifyAll()
|
String
|
toString()
|
final
void
|
wait(long arg0, int arg1)
|
final
void
|
wait(long arg0)
|
final
void
|
wait()
|
From interface
java.lang.AutoCloseable
Public Constructors
public
WeakPointerScope
()
Public Methods
public
void
attach
(Pointer pointer)
Attach a pointer to this scope.
Pointers attached to the scope will be automatically freed once the scope is closed, unless
they have been already released by the garbage collector
It this pointer
was already attached to this scope, this method has no effect.
Parameters
pointer |
pointer to attach |
Throws
IllegalStateException |
if that scope has already been closed
|
public
synchronized
void
close
()
public
void
detach
(Pointer pointer)
Detach a pointer from this scope.
Detaching a pointer from the scope will prevent its memory to be freed when closing the
scope.
If this pointer
is not attached to this scope, this method has no effect.
Parameters
pointer |
pointer to detach |
Throws
IllegalStateException |
if that scope has already been closed
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2021-11-29 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2021-11-29 UTC."],[],[],null,["# WeakPointerScope\n\npublic class **WeakPointerScope** \nA minimalist pointer scope only keeping weak references to its elements.\n\nAs opposed to [ERROR(/org.bytedeco.javacpp.PointerScope)](), instances of this class will not\nprevent the garbage collector to free the memory of a pointer that is no longer reachable, even\nif it has been attached to the scope.\n\nWhen the scope is closed, all pointers that are still valid will be automatically deallocated\nwhile those already garbage-collected will be ignored.\n\n\u003cbr /\u003e\n\n### Public Constructors\n\n|---|------------------------------------------------------------------------------------------------------|\n| | [WeakPointerScope](/jvm/api_docs/java/org/tensorflow/internal/WeakPointerScope#WeakPointerScope())() |\n\n### Public Methods\n\n|-------------------|------------------------------------------------------------------------------------------------------------------------------------------|\n| void | [attach](/jvm/api_docs/java/org/tensorflow/internal/WeakPointerScope#attach(Pointer))(Pointer pointer) Attach a pointer to this scope. |\n| synchronized void | [close](/jvm/api_docs/java/org/tensorflow/internal/WeakPointerScope#close())() |\n| void | [detach](/jvm/api_docs/java/org/tensorflow/internal/WeakPointerScope#detach(Pointer))(Pointer pointer) Detach a pointer from this scope. |\n\n### Inherited Methods\n\nFrom class java.lang.Object \n\n|------------------|---------------------------|\n| boolean | equals(Object arg0) |\n| final Class\\\u003c?\\\u003e | getClass() |\n| int | hashCode() |\n| final void | notify() |\n| final void | notifyAll() |\n| String | toString() |\n| final void | wait(long arg0, int arg1) |\n| final void | wait(long arg0) |\n| final void | wait() |\n\nFrom interface java.lang.AutoCloseable \n\n|---------------|---------|\n| abstract void | close() |\n\nPublic Constructors\n-------------------\n\n#### public\n**WeakPointerScope**\n()\n\n\u003cbr /\u003e\n\nPublic Methods\n--------------\n\n#### public void\n**attach**\n(Pointer pointer)\n\nAttach a pointer to this scope.\n\nPointers attached to the scope will be automatically freed once the scope is closed, unless\nthey have been already released by the garbage collector\n\nIt this `pointer` was already attached to this scope, this method has no effect.\n\n\u003cbr /\u003e\n\n##### Parameters\n\n| pointer | pointer to attach |\n|---------|-------------------|\n\n##### Throws\n\n| IllegalStateException | if that scope has already been closed |\n|-----------------------|---------------------------------------|\n\n#### public synchronized void\n**close**\n()\n\n\u003cbr /\u003e\n\n#### public void\n**detach**\n(Pointer pointer)\n\nDetach a pointer from this scope.\n\nDetaching a pointer from the scope will prevent its memory to be freed when closing the\nscope.\n\nIf this `pointer` is not attached to this scope, this method has no effect.\n\n\u003cbr /\u003e\n\n##### Parameters\n\n| pointer | pointer to detach |\n|---------|-------------------|\n\n##### Throws\n\n| IllegalStateException | if that scope has already been closed |\n|-----------------------|---------------------------------------|"]]