Skip to content

Segfault and memory leak on large data creation #107

Description

@ThomasMalletCodra

Windows crash in long-running test sessions due to GDI handle exhaustion (suspected object lifetime/cache issue)

Describe the bug

On Windows, PythonQwt may crash with an access violation during long-running test sessions.

The failure appears after extended execution (on a large test run on Windows), which is consistent with Windows GDI handle exhaustion. Windows limits GDI handles to roughly 10,000 per process, and the process seems to exceed that limit over time.

Current analysis suggests the issue is linked to object lifecycle and cache management in PythonQwt, especially for internal private data objects backed by Qt/C++ resources.

Regression might be introduced after optimization : #93

To Reproduce

  1. Run a large PythonQwt-dependent test suite on Windows in a single process with large data creation
  2. Monitor process GDI handle count over time (for example with Task Manager or Process Explorer).
  3. Continue until late-stage execution.
  4. Observe continuous handle growth and eventual crash/access violation near the GDI limit.

Ideas

  • Reintroduce QObject inheritance for the three affected PrivateData classes to ensure proper destruction and Qt-managed lifetime behavior.
  • Remove slots in these classes (suspected to interact poorly with asynchronous deallocation/lifetime expectations).
  • Add a defensive cache size limit.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions