Skip to content
← Back to activity

Immutable solution version

Large increase in memory usage in new Python SDK

Version 1Sign in to save

Complete solution

Teaches how to large increase in memory usage in new Python SDK. Based on a real issue report and its verified fix.

The problem

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

What to do

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.

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 1 · 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