MCPcopy Create free account
hub / github.com/bleachbit/bleachbit / fill_memory_linux

Function fill_memory_linux

bleachbit/Memory.py:129–148  ·  view source on GitHub ↗

Fill unallocated memory

()

Source from the content-addressed store, hash-verified

127
128
129def fill_memory_linux():
130 """Fill unallocated memory"""
131 report_free()
132 allocbytes = int(physical_free() * 0.4)
133 if allocbytes < 1024:
134 return
135 bytes_str = FileUtilities.bytes_to_human(allocbytes)
136 # TRANSLATORS: The variable is a quantity like 5kB
137 logger.info(_("Allocating and wiping %s of memory."),
138 bytes_str)
139 try:
140 buf = '\x00' * allocbytes
141 except MemoryError:
142 pass
143 else:
144 fill_memory_linux()
145 # TRANSLATORS: The variable is a quantity like 5kB
146 logger.debug(_("Freeing %s of memory."), bytes_str)
147 del buf
148 report_free()
149
150
151def get_swap_size_linux(device, proc_swaps=None):

Callers 1

wipe_memoryFunction · 0.85

Calls 2

report_freeFunction · 0.85
physical_freeFunction · 0.85

Tested by

no test coverage detected