-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BUG @127 not seeing a memory leak yet
- Loading branch information
Showing
1 changed file
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#!/usr/bin/env python | ||
|
||
""" | ||
try to provoke the memory leak described | ||
https://github.com/prjemian/spec2nexus/issues/127 | ||
file: /Users/hammonds/RSM_DATA/DanielHaskel/Brian-Nick/Fluorescence/lineup | ||
We don't have that one. | ||
""" | ||
|
||
|
||
import gc | ||
import os | ||
import resource | ||
from spec2nexus.spec import SpecDataFile | ||
import sys | ||
import time | ||
|
||
_path = os.path.dirname(__file__) | ||
# TESTFILE = "tests/data/issue119_data.txt" | ||
TESTFILE = os.path.join(_path, "data", "issue119_data.txt") | ||
|
||
|
||
def get_memory(): | ||
return resource.getrusage(resource.RUSAGE_SELF).ru_maxrss | ||
|
||
def task(): | ||
gc.collect() | ||
before = get_memory() | ||
# gc.set_debug(gc.DEBUG_LEAK) | ||
a = SpecDataFile(TESTFILE) | ||
after = get_memory() | ||
a = None | ||
gc.collect() | ||
final = get_memory() | ||
|
||
print(f"{before} {after} {final}") | ||
|
||
|
||
if __name__ == "__main__": | ||
for i in range(65): | ||
task() | ||
time.sleep(1.0) |