Wolfram Language
Paclet Repository
Community-contributed installable additions to the Wolfram Language
Primary Navigation
Categories
Cloud & Deployment
Core Language & Structure
Data Manipulation & Analysis
Engineering Data & Computation
External Interfaces & Connections
Financial Data & Computation
Geographic Data & Computation
Geometry
Graphs & Networks
Higher Mathematical Computation
Images
Knowledge Representation & Natural Language
Machine Learning
Notebook Documents & Presentation
Scientific and Medical Data & Computation
Social, Cultural & Linguistic Data
Strings & Text
Symbolic & Numeric Computation
System Operation & Setup
Time-Related Computation
User Interface Construction
Visualization & Graphics
Random Paclet
Alphabetical List
Using Paclets
Create a Paclet
Get Started
Download Definition Notebook
Learn More about
Wolfram Language
WeakCache
Guides
Weak Cache Functions
Symbols
CheckWeakCache
CleanupAfter
ClearHistory
ClearWeakCache
CreateReference
SameInstanceQ
SetWeakCache
StrongReference
WeakHashTable
WeakReference
JasonB`WeakCache`
C
r
e
a
t
e
R
e
f
e
r
e
n
c
e
C
r
e
a
t
e
R
e
f
e
r
e
n
c
e
[
e
x
p
r
]
r
e
t
u
r
n
s
a
s
t
r
o
n
g
r
e
f
e
r
e
n
c
e
t
o
t
h
e
i
n
p
u
t
e
x
p
r
e
s
s
i
o
n
.
C
r
e
a
t
e
R
e
f
e
r
e
n
c
e
[
e
x
p
r
,
"
W
e
a
k
"
]
r
e
t
u
r
n
s
a
w
e
a
k
r
e
f
e
r
e
n
c
e
t
o
t
h
e
i
n
p
u
t
e
x
p
r
e
s
s
i
o
n
.
D
e
t
a
i
l
s
a
n
d
O
p
t
i
o
n
s
Examples
(
2
)
Basic Examples
(
2
)
Create an object during and return a strong reference to it:
I
n
[
1
]
:
=
$
H
i
s
t
o
r
y
L
e
n
g
t
h
=
0
;
I
n
[
2
]
:
=
S
e
e
d
R
a
n
d
o
m
[
4
2
]
;
o
b
j
=
R
a
n
d
o
m
G
r
a
p
h
[
{
1
0
,
1
5
}
]
;
C
l
e
a
n
u
p
A
f
t
e
r
[
o
b
j
,
E
c
h
o
[
"
d
e
l
e
t
i
n
g
o
b
j
n
o
w
"
]
]
;
r
e
f
=
C
r
e
a
t
e
R
e
f
e
r
e
n
c
e
[
o
b
j
]
O
u
t
[
2
]
=
<
S
t
r
o
n
g
R
e
f
e
r
e
n
c
e
>
C
l
e
a
n
u
p
A
f
t
e
r
is used above to demonstrate when the underlying object is deleted from memory. Clearing the variable obj does not delete all references to the data:
I
n
[
3
]
:
=
o
b
j
=
.
You can still retrieve the stored object using the following notation:
I
n
[
4
]
:
=
r
e
f
[
]
O
u
t
[
4
]
=
Note that
r
e
f
is not equal to
o
b
j
:
I
n
[
5
]
:
=
B
y
t
e
C
o
u
n
t
/
@
{
r
e
f
,
r
e
f
[
]
}
O
u
t
[
5
]
=
{
4
0
,
8
8
8
}
r
e
f
is now the only reference to the underlying data, and deleting it will delete the data:
I
n
[
6
]
:
=
r
e
f
=
.
»
d
e
l
e
t
i
n
g
o
b
j
n
o
w
Create an object during and return a weak reference to it:
I
n
[
1
]
:
=
$
H
i
s
t
o
r
y
L
e
n
g
t
h
=
0
;
I
n
[
2
]
:
=
o
b
j
=
R
a
n
d
o
m
G
r
a
p
h
[
{
1
0
,
1
5
}
]
;
C
l
e
a
n
u
p
A
f
t
e
r
[
o
b
j
,
E
c
h
o
[
"
d
e
l
e
t
i
n
g
o
b
j
n
o
w
"
]
]
;
r
e
f
=
C
r
e
a
t
e
R
e
f
e
r
e
n
c
e
[
o
b
j
,
"
W
e
a
k
"
]
O
u
t
[
2
]
=
<
W
e
a
k
R
e
f
e
r
e
n
c
e
>
C
l
e
a
n
u
p
A
f
t
e
r
is used above to demonstrate when the underlying object is deleted from memory. Clearing the variable obj will delete all references to the data:
I
n
[
3
]
:
=
o
b
j
=
.
»
d
e
l
e
t
i
n
g
o
b
j
n
o
w
You can no longer retrieve the stored object using the weak reference:
I
n
[
4
]
:
=
r
e
f
[
]
O
u
t
[
4
]
=
F
a
i
l
u
r
e
M
e
s
s
a
g
e
:
T
h
e
r
e
f
e
r
e
n
c
e
h
a
s
e
x
p
i
r
e
d
.
T
a
g
:
E
x
p
i
r
e
d
R
e
f
e
r
e
n
c
e
S
e
e
A
l
s
o
W
e
a
k
R
e
f
e
r
e
n
c
e
▪
W
e
a
k
H
a
s
h
T
a
b
l
e
R
e
l
a
t
e
d
G
u
i
d
e
s
▪
W
e
a
k
C
a
c
h
e
F
u
n
c
t
i
o
n
s
"
"