js_flashcards_memory

(8 cards)

1
Q

What is memory management in JS?

A

Allocation/deallocation of memory resources. Automated in JS.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is garbage collection (GC)?

A

Automatic reclaiming of unused memory.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Explain mark-and-sweep GC.

A

Marks reachable objects, reclaims unmarked memory. Handles circular refs.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Common sources of memory leaks?

A

Globals, forgotten timers, closures, detached DOM, circular refs.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Prevent leaks from timers/listeners?

A

Clear timers, remove event listeners when done.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is memory profiling?

A

Use dev tools to analyze memory usage and leaks.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What are WeakMap and WeakSet?

A

Collections with weak references, allowing GC of unused objects.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

How does requestAnimationFrame help memory?

A

Schedules animations efficiently, reduces repaints and memory use.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly