Some registry hives can be as large as 2GB. Maybe not a big issue for most people, but also not difficult to fix. I went with the following solution using mmap for myself. It substantially reduces the time to read from a large hive and uses almost no memory.
import mmap
from Registry import RegistryParse
from Registry.Registry import Registry as _Registry
class Registry(_Registry):
def __init__(self, f):
self._buf = mmap.mmap(f.fileno(), 0, prot=mmap.ACCESS_READ)
self._regf = RegistryParse.REGFBlock(self._buf, 0, False)
Used like this:
with open(path) as f:
r = Registry(f)
# stuff
Some registry hives can be as large as 2GB. Maybe not a big issue for most people, but also not difficult to fix. I went with the following solution using
mmapfor myself. It substantially reduces the time to read from a large hive and uses almost no memory.Used like this: