Fill unallocated memory
()
| 127 | |
| 128 | |
| 129 | def 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 | |
| 151 | def get_swap_size_linux(device, proc_swaps=None): |
no test coverage detected