- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharray_allocation.py
More file actions
Latest commit
21 lines (13 loc) · 520 Bytes
/
Copy patharray_allocation.py
File metadata and controls
21 lines (13 loc) · 520 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
importnumpyasnp
importtime
importsys
frommemory_profilerimportmemory_usage
# Python float is 64 bit / 8 byte
ARRAY_SIZE=1000*1000*10
print("- Size of data array: {} MB".format(ARRAY_SIZE*8/ (1000*1000)))
defallocate_empty():
a=np.empty( (ARRAY_SIZE) )
if__name__=="__main__":
print(memory_usage((allocate_empty, (), {})))
# https://fa.bianp.net/blog/2013/different-ways-to-get-memory-consumption-or-lessons-learned-from-memory_profiler/
# https://pypi.org/project/memory-profiler/