lindell / lindell/JsBarcode

JS Barcode contains a memory leak.

Open
#296 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
5.9k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Description

JS Barcode seems to be creating a memory leak.

![Screen Shot 2019-07-12 at 2 26 04 PM](https://user-images.githubusercontent.com/161068/61150264-0580bb00-a4b1-11e9-849d-3874feaf1616.png)

I'm no expert, but I believe the problem lies in line 56 of this screen grab. You are referencing var API on line 43 which is global to window and the reference is never going away when the component re-renders. There needs to be some sort of cleanup to remove API on unmount. That's just my guess.

![Screen Shot 2019-07-12 at 2 28 33 PM](https://user-images.githubusercontent.com/161068/61150501-948dd300-a4b1-11e9-8fa0-c0e6918429e3.png)

Contributor guide

Open the contributing guide

Research direction

Start by locating the JS Barcode code corresponding to lines 43 and 56 in the screenshots, then reproduce repeated component renders in the browser and inspect whether the window-global API remains referenced. Confirm the lifecycle behavior and define done as cleanup occurring on unmount without breaking subsequent renders; no test file is mentioned.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.