Fixing a Memory Leak in Go: Understanding time.After
September 14, 2020
General
Estimated reading time: 2 minutes
Recently, we decided to investigate why our application ARANGOSYNC for synchronizing two ArangoDB clusters across data centers used up a lot of memory – around 2GB in certain cases. The environment contained ~1500 shards with 5000 GOroutines. Thanks to tools like pprof (to profile CPU and memory usage) it was very easy to identify the issue. The GO profiler showed us that memory was allocated in the function `time.After()` and it accumulated up to nearly 1GB. The memory was not released so it was clear that we had a memory leak. We will explain how memory leaks can occur using the `time.After()` function through three examples.
(more…)Get the latest tutorials,
blog posts and news:
Please enter a valid email address.
Thanks for subscribing! Please check your email for further instructions.
Something went wrong. Please check your entries and try again.
Tags
API
AQL
arangoml
arangosearch
arangosh
Benchmark
Cloud
Cluster
Community
Compliance
data science
Documentation
driver
Enterprise
Foxx
Fraud Detection
geo
GitHub
Graph
graph database
Graph Databases
HTTP
Java
JavaScript
Knowledge Graphs
Kubernetes
Machine Learning
Managed Service
ML
monitoring
multi-model
Newsletter
NoSQL
open-source
Performance
Pregel
python
pytorch
Release
RocksDB
Ruby
SOC 2
testing
Tutorial
WebUI