Skip to content

FIX memoryview leaks and retrofit memory-manager as context-managers #33

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 19 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
2347f3d
feat(enc): test with unicode tmpdir
ankostis Oct 23, 2016
883217b
fix(leaks): attempt to plug the leaks & filter dead regions
ankostis Oct 24, 2016
43c5f23
chore(ver): bump 2.0.1-->2.1.0.dev0
ankostis Oct 24, 2016
f10196f
fix(regs): fix/rename scream_if_closed()-->collect_closed_regions()
ankostis Oct 24, 2016
88e2769
chore(ver): bump 2.0.1-->2.1.0.dev1
ankostis Oct 24, 2016
133dd1c
style(listuple): pep8, literals for empty lists/tuples
ankostis Oct 24, 2016
7c1eac7
refact(region): rename offset `_b --> _ofs`
ankostis Oct 24, 2016
bba086a
refact(minor): use region.priv-func, close fd on same condition
ankostis Oct 25, 2016
a2bc2d2
feat(mman): BREAKING API `mman` as context-manager to release regions
ankostis Oct 25, 2016
01df7f3
chore(ver): bump 2.1.0.dev1-->2.1.0.dev3
ankostis Oct 25, 2016
bf68f77
feat(mman-contxt): opt-out not to scream if mman not entered
ankostis Oct 25, 2016
4598966
fix(leaks): attempt to gc-collect before region-collect
ankostis Oct 25, 2016
d0bd74e
fix(mman): exit log-msg were missing left-overs arg, log as debug
ankostis Oct 25, 2016
e33235a
refact(buf): also use SlidingWindowMapBuffer as optional context-manager
ankostis Oct 25, 2016
33f12e6
refact(TCs): unittestize assertions
ankostis Oct 25, 2016
8489c31
refact(buf): simplify API - no begin/end after construct
ankostis Oct 25, 2016
d81dc1d
style(mman): move managed_mmaps() closer to 2 mmans
ankostis Oct 25, 2016
9ba1649
fix(leaks): FIX memoryview leak in Windows
ankostis Oct 27, 2016
144891b
chore(ver): bump 2.1.0.dev3-->2.1.0.dev4
ankostis Oct 27, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix(leaks): attempt to gc-collect before region-collect
futile...
  • Loading branch information
ankostis committed Oct 25, 2016
commit 4598966aba7bbf8873de5e29893117b95f601379
4 changes: 4 additions & 0 deletions smmap/mman.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
string_types,
buffer,
)
import gc


__all__ = ['managed_mmaps', "StaticWindowMapManager", "SlidingWindowMapManager", "WindowCursor"]
Expand Down Expand Up @@ -351,6 +352,9 @@ def __exit__(self, exc_type, exc_value, traceback):
assert self._entered > 0, self._entered
self._entered -= 1
if self._entered == 0:
# Try to close all file-handles
#(a *Windows* only issue, and probably not fixed)
gc.collect()
leaft_overs = self.collect()
if leaft_overs:
log.warning("Cleaned up %s left-over mmap-regions.")
Expand Down