Created
October 16, 2016 02:09
-
-
Save ds7711/85261bf1f484cb79e65b3fb27f153d91 to your computer and use it in GitHub Desktop.
test measure_memory_usage
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
def SomeLongRunningLibraryCall(arg1, arg2): | |
import time | |
max_dict_entries = 2500 | |
delay_per_entry = .005 | |
some_large_dictionary = {} | |
dict_entry_count = 0 | |
while(1): | |
time.sleep(delay_per_entry) | |
dict_entry_count += 1 | |
some_large_dictionary[dict_entry_count]=range(20000) | |
if dict_entry_count % 100 == 0: | |
print dict_entry_count | |
if len(some_large_dictionary) > max_dict_entries: | |
break | |
print arg1 + " " + arg2 | |
return "Good Bye World" | |
from memory_usage import measure_memory_usage | |
memory_usage = measure_memory_usage(SomeLongRunningLibraryCall, ("Hello", "world")) | |
print memory_usage |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment