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 issue in node application #71

Closed
priidikvaikla opened this issue Mar 1, 2017 · 6 comments
Closed

Memory issue in node application #71

priidikvaikla opened this issue Mar 1, 2017 · 6 comments

Comments

@priidikvaikla
Copy link

Hey guys,

I'm using this library v0.3.1 in a node v6.9.5 application. Actually the application runs inside docker container but I'm able to reproduce the problem with following script. The script is

'use strict';

const googleMapsClient = require('@google/maps').createClient({
  key: '...'
});

setInterval(() => {
  googleMapsClient.geocode({
    address: '1600 Amphitheatre Parkway, Mountain View, CA'
  }, function(err, response) {
    if (!err) {
      console.log(response.json.results[0].formatted_address);
    }
  });
}, 2000);

and I see memory increasing as every new address gets geocoded. Is it supposed to increase like this or am I doing something in a wrong way? Memory heap snapshots are here Heap.zip

@priidikvaikla
Copy link
Author

The other thing was that I was thinking that maybe it's more GC issue in node so I set --max-old-space-size= limit and it seemed that more memory was freed but it still went over that limit eventually

@priidikvaikla
Copy link
Author

@stephenfarrar @stephenmcd Is there any way you could look into this issue?

@jaumebn
Copy link

jaumebn commented Mar 8, 2017

Hi!

I am experiencing the same issue here. Every time a call to googleMapsClient is performed, the memory usage keeps increasing and increasing. I had a script to geocode 35k addresses and it runs out of memory (1GB+) before reaching 40% of addresses processed. I am not sure if it is safe to use this client in production as after some hours running it would be using tons of memory.

If if require the googleMaps client again every 100 calls, memory usage keeps at reasonable levels. However, I don't think this is a good solution for production environments. Any advise on this?

Thanks!

@kilpa
Copy link

kilpa commented Mar 8, 2017

When looking trough the heapdumps I saw that in some array lots of objects are held, and found out that those objects refer to some kind of buffer. It looks like that this array is filled for every request but never cleaned up after usage.

@priidikvaikla
Copy link
Author

This seems not to be the issue because the size of that items array doesn't go beyond the size which is 10 by default. Any other ideas?

@stephenfarrar
Copy link
Contributor

Thanks for reporting. I'll take a look...

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

4 participants