Skip to content

Commit 2ff8340

Browse files
authored
Merge pull request #1736 from volatilityfoundation/feature/use-less-memory
Feature/use less memory
2 parents a79c58b + de11e87 commit 2ff8340

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

volatility3/framework/interfaces/objects.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import collections.abc
99
import contextlib
1010
import logging
11-
from typing import Any, Dict, List, Mapping, Optional
11+
from typing import Any, List, Mapping, Optional
1212

1313
from volatility3.framework import constants, interfaces
1414

@@ -127,8 +127,11 @@ def __init__(
127127
mask = context.layers[object_info.layer_name].address_mask
128128
normalized_offset = object_info.offset & mask
129129

130+
vol = kwargs
130131
vol_info_dict = {"type_name": type_name, "offset": normalized_offset}
131-
self._vol = collections.ChainMap({}, vol_info_dict, object_info, kwargs)
132+
vol.update(object_info)
133+
vol.update(vol_info_dict)
134+
self._vol = collections.ChainMap({}, vol)
132135
self._context = context
133136

134137
def __getattr__(self, attr: str) -> Any:
@@ -309,10 +312,9 @@ def __init__(self, type_name: str, **arguments) -> None:
309312
"""Stores the keyword arguments for later object creation."""
310313
# Allow the updating of template arguments whilst still in template form
311314
super().__init__()
312-
empty_dict: Dict[str, Any] = {}
313-
self._vol = collections.ChainMap(
314-
empty_dict, arguments, {"type_name": type_name}
315-
)
315+
vol = {"type_name": type_name}
316+
vol.update(arguments)
317+
self._vol = collections.ChainMap({}, vol)
316318

317319
@property
318320
def vol(self) -> ReadOnlyMapping:

0 commit comments

Comments
 (0)