Skip to content

Conversation

@PeterPetrik
Copy link
Contributor

@PeterPetrik PeterPetrik commented Jan 16, 2024

  • introduced pygeodiff.shutdown() to correctly unload on windows
  • pulled out context from geodifflib to geodiff
  • geodifflib is now shared between all instances of pygeodiff.GeoDiff()
  • bumped ver

latest python had some problems with comments with \ so I replaced it with :

fix #205

@PeterPetrik PeterPetrik changed the title WIP: lazy loaded clib lazy loaded clib Jan 17, 2024
@dvdkon
Copy link
Contributor

dvdkon commented Dec 19, 2025

I rebased this PR on current master.

@wonder-sk
Copy link
Contributor

actually...

  • is it correct that GeoDiff class calls shutdown() upon its destruction? I think that may cause a series of loads and unloads of the geodiff C library when GeoDiff is created and deleted in sequence - or not?
  • and do I understand it correctly that each GeoDiff has its own GeoDiffLib instance? (the PR description says the geodifflib should be shared now?)

@dvdkon
Copy link
Contributor

dvdkon commented Dec 19, 2025

  • is it correct that GeoDiff class calls shutdown() upon its destruction? I think that may cause a series of loads and unloads of the geodiff C library when GeoDiff is created and deleted in sequence - or not?

Hm, I missed that. I think it doesn't make sense, since GeoDiffLib.shutdown() is also called by GeoDiffLib.__del__. But loading/unloading the library when multiple GeoDiff objects are created with distinct lifetimes is probably unavoidable, if the goal is to unload the library when it's no longer needed.

  • and do I understand it correctly that each GeoDiff has its own GeoDiffLib instance? (the PR description says the geodifflib should be shared now?)

Yes, this way we'll end up with multiple GeoDiffLib instances (that will clean up after themselves on Windows, but still). I'll commit a fix.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a method to unload geodiff library from python

4 participants