Skip to content

Large hives can take up large amounts of memory #75

Description

@dhagrow

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions