Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory leak in creation of tensor #7

Closed
drmanhatin opened this issue Jan 12, 2021 · 2 comments
Closed

Memory leak in creation of tensor #7

drmanhatin opened this issue Jan 12, 2021 · 2 comments

Comments

@drmanhatin
Copy link

Hi,

There's a memory leak in this library. Happens after a few dozens of tensors have been created. I can show you on teams if you like, just send me a message.

My (working) implementation of tensorflowjs is accessible at https://github.com/drmanhatin/CustomVisionRealTime/blob/main/nodejsdemo/public/main.js.

Most important part:

   let t4d = tf.tidy(() => {
          const image = tf.browser.fromPixels(canvas).resizeBilinear([320, 320])
          return tf.tensor4d(image.dataSync(), [1, 320, 320, 3])
  })

Wrapping with tidy ensures automatic cleanup.

@shonohs
Copy link
Contributor

shonohs commented Jan 13, 2021

Hello,

Thanks for reporting the issue. I will look into it and make a fix this week.

@shonohs
Copy link
Contributor

shonohs commented Jan 14, 2021

Fixed the memory leak in f9c6003

@shonohs shonohs closed this as completed Jan 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants