Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit add412f

Browse filesBrowse files
committed
update gc nb
1 parent 1f54d31 commit add412f
Copy full SHA for add412f

File tree

Expand file treeCollapse file tree

1 file changed

+40
-22
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+40
-22
lines changed

‎examples/garbage_collection.ipynb

Copy file name to clipboardExpand all lines: examples/garbage_collection.ipynb
+40-22Lines changed: 40 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -72,53 +72,63 @@
7272
{
7373
"cell_type": "code",
7474
"execution_count": null,
75-
"id": "e26d392f-6afd-4e89-a685-d618065d3caf",
75+
"id": "27627cd4-c363-4eab-a121-f6c8abbbe5ae",
7676
"metadata": {
7777
"tags": []
7878
},
7979
"outputs": [],
8080
"source": [
81-
"# for line\n",
82-
"# a = np.random.rand(10_000_000)\n",
83-
"\n",
84-
"# for heatmap\n",
85-
"# a = np.random.rand(20_000, 20_000)\n",
86-
"\n",
87-
"# for line collection\n",
88-
"# a = np.random.rand(500, 50_000)\n",
89-
"\n",
90-
"# for image\n",
91-
"# a = np.random.rand(7_000, 7_000)\n",
92-
"\n",
93-
"# for scatter\n",
94-
"a = np.random.rand(10_000_000, 3)"
81+
"graphic = \"scatter\""
82+
]
83+
},
84+
{
85+
"cell_type": "markdown",
86+
"id": "d9c10edc-169a-4dd2-bd5b-8a1b67baf3a9",
87+
"metadata": {},
88+
"source": [
89+
"### Run the following cells repeatedly to add and remove the graphic"
9590
]
9691
},
9792
{
9893
"cell_type": "code",
9994
"execution_count": null,
100-
"id": "31e3027a-56cf-4f7b-ba78-aed4f78eef47",
95+
"id": "e26d392f-6afd-4e89-a685-d618065d3caf",
10196
"metadata": {
10297
"tags": []
10398
},
10499
"outputs": [],
105100
"source": [
106-
"print_process_ram_mb()"
101+
"if graphic == \"line\":\n",
102+
" a = np.random.rand(10_000_000)\n",
103+
" g = plot.add_line(a)\n",
104+
" \n",
105+
"elif graphic == \"heatmap\":\n",
106+
" a = np.random.rand(20_000, 20_000)\n",
107+
" g = plot.add_heatmap(a)\n",
108+
"\n",
109+
"elif graphic == \"line_collection\":\n",
110+
" a = np.random.rand(500, 50_000)\n",
111+
" g = plot.add_line_collection(a)\n",
112+
" \n",
113+
"elif graphic == \"image\":\n",
114+
" a = np.random.rand(7_000, 7_000)\n",
115+
" g = plot.add_image(a)\n",
116+
"\n",
117+
"elif graphic == \"scatter\":\n",
118+
" a = np.random.rand(10_000_000, 3)\n",
119+
" g = plot.add_scatter(a)"
107120
]
108121
},
109122
{
110123
"cell_type": "code",
111124
"execution_count": null,
112-
"id": "9cf2ceaa-5b01-4e12-be39-f267cd355833",
125+
"id": "31e3027a-56cf-4f7b-ba78-aed4f78eef47",
113126
"metadata": {
114127
"tags": []
115128
},
116129
"outputs": [],
117130
"source": [
118-
"# g = plot.add_line_collection(a)\n",
119-
"# g = plot.add_heatmap(a)\n",
120-
"# g = plot.add_line(a)\n",
121-
"g = plot.add_scatter(a)"
131+
"print_process_ram_mb()"
122132
]
123133
},
124134
{
@@ -169,6 +179,14 @@
169179
"plot.delete_graphic(plot.graphics[0])"
170180
]
171181
},
182+
{
183+
"cell_type": "markdown",
184+
"id": "47baa487-c66b-4c40-aa11-d819902870e3",
185+
"metadata": {},
186+
"source": [
187+
"If there is no serious system memory leak, this value shouldn't really increase after repeated cycles"
188+
]
189+
},
172190
{
173191
"cell_type": "code",
174192
"execution_count": null,

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.