GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — MerginProject may not get cleaned up properly · Issue #149 · MerginMaps/python-api-client

MerginProject may not get cleaned up properly #149

New issue
Copy link
New issue
Copy link
Open
Open
MerginProject may not get cleaned up properly#149
Copy link
Labels
bugSomething isn't workingSomething isn't working

Description

@wonder-sk
wonder-sk
opened on Oct 18, 2022
Issue body actions

When MerginProject is created, it creates geodiff object and assigns an internal logger to geodiff. This creates a cyclic reference (pygeodiff refs MerginProject, and MerginProject refs pygeodiff) that may keep resources held, which may be a problem if MerginProject object is created many times. See also fix for this in db-sync: MerginMaps/db-sync#79

Also somehow related: MerginMaps/geodiff#190

Code snippet to replicate the cleanup issue:

import pygeodiff

class MerginProjectX:

    def __init__(self, directory):

        def _logger_callback(level, text_bytes):
            self.x()   # not a real function, but refs this object...

        self.geodiff = pygeodiff.GeoDiff()
        self.geodiff.set_logger_callback(_logger_callback)

# this will keep consuming more and more resources
for i in range(50000):
    print(i)
    mp = MerginProjectX("x")
    #mp.geodiff = None    # this helps to break ref cycle
    time.sleep(0.005)

Activity

  1. wonder-sk
    added
    bugSomething isn't workingSomething isn't working
    on Oct 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.