The team at brand.dev faced significant memory issues with their Node.js image processing service, particularly when using the Sharp library, which led to server crashes. Initial investigations suggested a memory leak, but further analysis revealed that the problem was actually memory fragmentation caused by the multithreaded nature of the underlying C++ library used by Sharp. The default memory allocator on Linux, glibc's malloc, poorly handled this scenario, leading to inefficient memory use. To resolve this, they switched to jemalloc, a more efficient memory allocator, which significantly reduced memory usage. Additionally, they found that managing the concurrency of image processing and adopting a streaming approach rather than a buffer-based one helped maintain a stable memory profile. The team also made various optimizations, such as disabling Sharp's cache when unnecessary and adjusting concurrency settings, which further improved performance. The solution was largely informed by the community's shared experiences on platforms like GitHub and Stack Overflow, highlighting the importance of collaboration in overcoming technical challenges.