Skip to content

Commit 21c91be

Browse files
committed
[Typo]
1 parent bd8d7b1 commit 21c91be

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

1. Fundamentals/2023-06-15-Resource Management - Dispose Pattern.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ categories: [VSCode, Fundamentals]
88

99
JavaScript utilizes Garbage Collection (GC) to manage memory. As a result, we don't have direct control over resource management—**we can't tell when a resource is actually released once the reference count of a variable drops to zero**.
1010

11-
However, we can simulate this process (this is also what VSCode does):
11+
However, we can simulate this process (this is also how VSCode does it):
1212
> What is a **resource** then? A resource could be file handles, network sockets, or database connections, as well as more direct allocations of memory (number, string, boolean, arrays, objects, etc.).
1313
1414
Let us consider three examples to illustrate your bad resource (or memory) management:
@@ -57,7 +57,7 @@ class MyArray {
5757
}
5858

5959
public destruct(): void {
60-
this.arr = [];
60+
this.arr.length = 0;
6161
}
6262
}
6363

0 commit comments

Comments
 (0)