Skip to content

Fix high memory usage

Server-side bottlenecks profiled and removed

  • Senior engineers · IST + EST overlap
  • NDA on day 1
  • 24-hour reply

Tell us what you need fixed

Reply in 24 hours · NDA on day 1 · No spam.

Fix high memory usage — done properly, by senior engineers

We help engineering teams fix high memory usage in Node.js, Python and JVM services by finding what the heap is retaining and why, so the restart cron can finally be deleted. Memory that grows until the container is OOM-killed with exit code 137 usually traces to a short list: in-process caches without a size limit, event listeners or timers never removed, request data parked in module-level structures, or streams buffering because backpressure is ignored. Not every rise is a leak. Resident memory can grow outside the JavaScript heap through Buffers and native libraries, glibc allocator fragmentation is common in image processing, and a heap limit set above the container limit means the kernel kills the process before the runtime can raise a clean out-of-memory error. Krapton’s engineers compare heap snapshots taken under steady load, read retainer paths in Chrome DevTools, and use tracemalloc or memray for Python and heap dumps with Eclipse MAT for the JVM. Data stores get the same scrutiny: Redis without maxmemory, and PostgreSQL work_mem multiplied across concurrent queries. You receive the root causes, patches, a soak-test result and memory alerts tuned to your limits.

What you're seeing

Your service's memory grows until it OOMs and the only "fix" is a restart cron.

Our approach

We capture heap snapshots, find the leak (caches, closures, listeners), patch it, and add memory-alert thresholds tied to your existing monitoring.

Symptoms teams come to us with

  • Memory climbs steadily for hours or days until pods restart with OOMKilled and exit code 137.
  • A scheduled restart or PM2’s max_memory_restart setting is the only thing keeping the service up.
  • Resident memory keeps growing on the host while heapUsed from process.memoryUsage() stays flat.
  • Node logs MaxListenersExceededWarning, or heap snapshots show thousands of identical closures and listeners.
  • The database or Redis host runs out of memory during peaks, and the Linux OOM killer steps in.

What we check first

  1. In-process caches built on Map or plain objects with no maximum size or eviction policy.
  2. Event listeners, intervals and subscriptions registered per request or connection and never removed.
  3. Native memory growth from Buffers, image libraries and glibc arena fragmentation outside the JavaScript heap.
  4. Heap limits such as --max-old-space-size or -Xmx set higher than the container memory limit.
  5. Redis without maxmemory, or PostgreSQL work_mem sized without accounting for concurrent sorts and hashes.

Concrete deliverables, no fluff

Every engagement ends with measurable, documented outcomes — no black-box agency reports.

  • Profiling report with the top 5 bottlenecks
  • Implementation of fixes + benchmarks
  • Alerts wired to your existing monitoring
  • Capacity-planning notes for the next 12 months

What changes after we ship

  • Leaks found by retainer path

    Heap snapshot comparisons identify which objects accumulate and the reference chain holding them, so the fix removes the cause instead of trimming symptoms.

  • Bounded caches by design

    In-memory caches get explicit size limits and eviction through LRU structures, or move to Redis with maxmemory and a deliberate eviction policy.

  • Limits aligned with containers

    Runtime heap limits, container memory requests and limits, and allocator settings are set consistently, so memory pressure produces a clear signal well before the kernel kills anything.

  • A soak test that proves it

    A long-running load test at realistic traffic confirms memory reaches a plateau after the fix, recorded as a graph you can compare against future releases.

From brief to shipped fix

A transparent, low-risk process — a senior engineer reads your brief personally, and nothing starts until you approve a written plan and price.

  1. 01Day 0–1

    Diagnose

    A senior engineer reviews your brief, reproduces the issue, and pinpoints the real root cause — not the symptom — before any code is touched.

  2. 02Within 24h

    Scoped plan & quote

    You get a written plan to fix High Memory Usage, a firm timeline, and a fixed quote. Nothing starts until you approve it — no surprise invoices.

  3. 031–3 weeks

    Ship the fix

    We implement on a branch and open a pull request you review, working to your code-review standards on your repo — never a black box.

  4. 04On delivery

    Verify & hand off

    We verify on staging and production, share before/after evidence where it applies, and leave you a short hand-off note so the fix sticks.

Situations we handle

  • Node API leaking per request

    Each request registers a listener on a shared emitter and never removes it. Snapshots reveal the growth, we fix the lifecycle, and memory holds steady across a full traffic cycle.

  • Image service with fragmented RSS

    A sharp-based thumbnail service grows resident memory while its heap stays small. We switch the allocator to jemalloc or tune glibc arenas, and cap concurrency per process.

  • Python workers growing over time

    Celery or Gunicorn workers grow until they are restarted. We trace allocations with tracemalloc and memray, fix the retained references, and keep worker recycling only as a safety net.

Why teams hand this task to Krapton

  • Senior engineers only

    Your brief is read and handled by a senior engineer — no junior hand-off, no sales-rep filter in between.

  • Root cause, not a patch

    We reproduce and fix the underlying cause, then add a guard so the same class of issue does not quietly return.

  • Your repo, your standards

    Every change lands as a pull request you review, on your repository, following your existing review process.

  • NDA on day one

    Confidentiality and IP are covered before we look at a single line of code. All work stays in your accounts.

  • Fixed quote up front

    You approve a written plan and price before work starts. If scope changes, we re-quote in writing — no surprise invoices.

  • Proof, where it applies

    Performance, SEO and reliability work ships with before/after evidence so the result is measurable, not anecdotal.

Three ways to engage

No retainer required. Pick the model that matches the work — pricing for this task starts from $500, with a fixed quote before anything starts.

  • Per task

    Most popular

    One clearly-scoped fix at a fixed price. Best when you know exactly what is broken and want it handled end to end.

    • Fixed quote up front
    • One PR, reviewed by you
    • No retainer required
  • Hourly

    Pay only for the hours worked. Best for diagnostics, audits, or exploratory work where the scope is still emerging.

    • Weekly timesheets
    • Pay for what you use
    • No minimum commitment
  • Per sprint

    A focused 1–2 week sprint when the work is bigger than one fix but smaller than a full project.

    • 1–2 week blocks
    • Clear sprint goal
    • Scale up or stop anytime

Industry-standard stack, no proprietary lock-in

  • Node.js
  • PostgreSQL
  • Redis
  • Docker
  • Nginx

Fix high memory usage — your questions, answered

How much does it cost to fix High Memory Usage?

Pricing starts from $500 and depends on the scope we find during the diagnostic. You get a fixed, written quote before any work begins — most engagements like this run 1–3 weeks.

How long does it take to fix High Memory Usage?

Typically 1–3 weeks for a focused engagement. After a short diagnostic we commit to a firm timeline so you know exactly what to expect.

Is a restart cron an acceptable way to fix high memory usage?

Not as a fix, only as a temporary guard. Scheduled restarts hide the leak, drop in-flight requests if shutdown is not graceful, and fail the day traffic grows faster than the restart interval. We keep a recycle limit as a safety net where the runtime supports it, but the goal is a service whose memory plateaus under steady load without intervention.

How do you tell a memory leak from normal growth?

By watching what happens under steady load. Runtimes reserve memory as they warm up, caches fill, and garbage collectors run lazily, so early growth is normal. A leak keeps growing after warm-up at constant traffic, and heap snapshots taken minutes apart show the same object types accumulating. Resident memory rising while the heap stays flat points to native memory instead.

Should we just give the service more memory?

Sometimes that is the right call. If profiling shows the working set is legitimately large, such as a big in-memory index, more memory or a larger instance costs less than engineering time. If memory keeps growing, more RAM only stretches the time between crashes. We measure the steady-state working set first, then recommend limits with headroom.

Let's get this off your plate

Send a 60-second brief on Fix High Memory Usage and a senior engineer replies within 24 hours with a plan and a fixed quote. NDA on day one, no retainer required.