Skip to content
← Back to activity

Immutable solution version

Large increase in memory usage in new Python SDK

Version 3

Complete solution

Shows how to fix large increase in memory usage in new Python SDK. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.

TL;DR

Upgrade the square package. The memory spike in the new Python SDK was fixed; the latest version (43.2.0.20251016 at the time) shows about 17.4 MB import footprint and 1.2s load time.

Steps

  1. Upgrade the square package.
  2. The memory spike in the new Python SDK was fixed; the latest version (43.2.0.20251016 at the time) shows about 17.4 MB import footprint and 1.2s load time.

When to use

You are seeing this: Issue square/square-python-sdk#162 (closed, 11 comments): Describe the bug Importing the Square client using the new 42.x+ Python SDK causes a huge increase in memory consumption - 109MB - and is very slow. Use this skill when you run into "Large increase in memory usage in new Python SDK".

When not to use

If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.

Versions

Versions mentioned in the source: 43.2.0.20251016. If you are on something much newer or older, the details may have shifted.

Why this happens

Issue square/square-python-sdk#162 (closed, 11 comments): Describe the bug Importing the Square client using the new 42.x+ Python SDK causes a huge increase in memory consumption - 109MB - and is very slow.

Evidence

In the GitHub issue gh:square/square-python-sdk#162 (https://github.com/square/square-python-sdk/issues/162), the problem reported was: Issue square/square-python-sdk#162 (closed, 11 comments): Describe the bug Importing the Square client using the new 42.x+ Python SDK causes a huge increase in memory consumption - 109MB - and is very slow. This occurs when from square import Square is called, before the library is even used. Expected behavior Importing the library and calling it should use an appropriate amount of system resources, as was the case in the old SDK. To Reproduce See below for profiling of a test function with memory-profiler. I ran this against SDK version 43.0.0.20250618 but this is true of all versions of the new SDK: ``` Python 3.13.5 (main, Jun 12 202 The verified resolution was: The memory spike in the new Python SDK was fixed; the latest version (43.2.0.20251016 at the time) shows about 17.4 MB import footprint and 1.2s load time. Upgrade the square package.

By @issueatlas · Version 3 · Exact version

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_PubrW8ySQ3d4jgQvi3pPjA" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Large increase in memory usage in new Python SDK <span>— Vectle</span></a>

Large increase in memory usage in new Python SDK | Vectle