René's URL Explorer Experiment


Title: register_vector leaks dumper classes on every call · Issue #168 · pgvector/pgvector-python · GitHub

Open Graph Title: register_vector leaks dumper classes on every call · Issue #168 · pgvector/pgvector-python

X Title: register_vector leaks dumper classes on every call · Issue #168 · pgvector/pgvector-python

Description: Hi! Investigating a memory leak in our API, we found out that register_vector (and register_vector_async) creates 8 classes on every call that are never garbage collected if psycopg's C extension is in use, even after the connection is c...

Open Graph Description: Hi! Investigating a memory leak in our API, we found out that register_vector (and register_vector_async) creates 8 classes on every call that are never garbage collected if psycopg's C extension i...

X Description: Hi! Investigating a memory leak in our API, we found out that register_vector (and register_vector_async) creates 8 classes on every call that are never garbage collected if psycopg's C extensi...

Opengraph URL: https://github.com/pgvector/pgvector-python/issues/168

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"register_vector leaks dumper classes on every call","articleBody":"Hi!\nInvestigating a memory leak in our API, we found out that `register_vector` (and `register_vector_async`) creates 8 classes on every call that are never garbage collected if psycopg's C extension is in use, even after the connection is closed.\n\nThis is because these classes are stored by psycopg in a dict shared by the whole python process, and never cleared. \n\npgvector python 0.4.2 (but the code has not been updated on master) and psycopg 3.3.2\n\nTo reproduce:\n```python\nimport gc\nfrom types import SimpleNamespace\n\nimport psycopg\nfrom pgvector.psycopg.vector import (\n    VectorBinaryDumper,\n    VectorDumper,\n    register_vector_info,\n)\nfrom psycopg.adapt import AdaptersMap\nfrom psycopg.types import TypeInfo\n\n\ndef count() -> int:\n    gc.collect()\n    return sum(\n        1\n        for base in (VectorDumper, VectorBinaryDumper)\n        for c in base.__subclasses__()\n        if c.__name__ == \"\"\n    )\n\n\nprint(psycopg.__version__, psycopg.pq.__impl__)\nbefore = count()\nfor _ in range(1000):\n    ctx = SimpleNamespace(adapters=AdaptersMap(psycopg.adapters))\n    register_vector_info(ctx, TypeInfo(\"vector\", 16385, 16386))\n    del ctx\nprint(\"leaked dumper classes:\", count() - before)  # expected 0, prints 2000\n```\n\n\nCaching these classes as done by psycopg could fix the issue : https://github.com/psycopg/psycopg/blob/99356800e90aa0e7b604f652d714ef0f33422b47/psycopg/psycopg/types/hstore.py#L225","author":{"url":"https://github.com/lsviennot","@type":"Person","name":"lsviennot"},"datePublished":"2026-10-21T16:03:26Z","url":"https://github.com/pgvector/pgvector-python/issues/168"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:eff30475-1cdf-4d7b-a699-2a9e99aaae3a
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id8B76:202219:659D6D:8D4F14:6AFEAAF9
html-safe-nonce0e23b7a7c6ba257b80ee19a69afdff1b235939b7d84db888ae9134a874bbc09d
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4Qjc2OjIwMjIxOTo2NTlENkQ6OEQ0RjE0OjZBRkVBQUY5IiwidmlzaXRvcl9pZCI6Ijc1Mjg0NjA5NDQ0NDQxNDAyODEiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac463582a26cb688b65567f97029df076fe1c87125c3cf88876802a9d841454abb
hovercard-subject-tagissue:5964050188
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/pgvector/pgvector-python/168/issue_layout
twitter:imagehttps://opengraph.githubassets.com/821b79035577e82007db923ebec84ad940be4f6f50f846009dd999da19aefc49/pgvector/pgvector-python/issues/168
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/821b79035577e82007db923ebec84ad940be4f6f50f846009dd999da19aefc49/pgvector/pgvector-python/issues/168
og:image:altHi! Investigating a memory leak in our API, we found out that register_vector (and register_vector_async) creates 8 classes on every call that are never garbage collected if psycopg's C extension i...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamelsviennot
hostnamegithub.com
expected-hostnamegithub.com
None95b2753c978240785d6cca00783c00a371b2d7d9879bb32e305170a1b19bd28e
turbo-cache-controlno-preview
go-importgithub.com/pgvector/pgvector-python git https://github.com/pgvector/pgvector-python.git
octolytics-dimension-user_id98363230
octolytics-dimension-user_loginpgvector
octolytics-dimension-repository_id376300726
octolytics-dimension-repository_nwopgvector/pgvector-python
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id376300726
octolytics-dimension-repository_network_root_nwopgvector/pgvector-python
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release3f25273206cd841171bca0002261ae4c9757d934
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/pgvector/pgvector-python/issues/168#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpgvector%2Fpgvector-python%2Fissues%2F168
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpgvector%2Fpgvector-python%2Fissues%2F168
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=pgvector%2Fpgvector-python
Reloadhttps://github.com/pgvector/pgvector-python/issues/168
Reloadhttps://github.com/pgvector/pgvector-python/issues/168
Reloadhttps://github.com/pgvector/pgvector-python/issues/168
pgvectorhttps://github.com/pgvector
pgvector-pythonhttps://github.com/pgvector/pgvector-python
Codehttps://github.com/pgvector/pgvector-python
Issues2 (2)https://github.com/pgvector/pgvector-python/issues
Pull requests8 (8)https://github.com/pgvector/pgvector-python/pulls
Actionshttps://github.com/pgvector/pgvector-python/actions
Security and qualityhttps://github.com/pgvector/pgvector-python/security
Insightshttps://github.com/pgvector/pgvector-python/insights
https://github.com/pgvector/pgvector-python
New issuehttps://github.com/login?return_to=https://github.com/pgvector/pgvector-python/issues/168
New issuehttps://github.com/login?return_to=https://github.com/pgvector/pgvector-python/issues/168
register_vector leaks dumper classes on every callhttps://github.com/pgvector/pgvector-python/issues/168#top
https://github.com/lsviennot
lsviennothttps://github.com/lsviennot
on Oct 21, 2026https://github.com/pgvector/pgvector-python/issues/168#issue-5964050188
https://github.com/psycopg/psycopg/blob/99356800e90aa0e7b604f652d714ef0f33422b47/psycopg/psycopg/types/hstore.py#L225https://github.com/psycopg/psycopg/blob/99356800e90aa0e7b604f652d714ef0f33422b47/psycopg/psycopg/types/hstore.py#L225
ankanehttps://github.com/ankane
completedhttps://github.com/pgvector/pgvector-python/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
97e9fefhttps://github.com/pgvector/pgvector-python/commit/97e9fefe23fdc787e3bea96f06b1d2686f8b6d5d
on Oct 21, 2026https://github.com/pgvector/pgvector-python/issues/168#event-33884605079
https://github.com/ankane
ankanehttps://github.com/ankane
on Oct 21, 2026https://github.com/pgvector/pgvector-python/issues/168#issuecomment-6325465711
@lsviennothttps://github.com/lsviennot
Sign up for freehttps://github.com/signup?return_to=https://github.com/pgvector/pgvector-python/issues/168
Sign in to commenthttps://github.com/login?return_to=https://github.com/pgvector/pgvector-python/issues/168
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.