Core: Half the memory usage by not storing arguments

This commit is contained in:
Mike Auty
2020-08-23 23:34:18 +01:00
parent 807614aa45
commit 0cbca4c957
2 changed files with 3 additions and 4 deletions
+1 -2
View File
@@ -273,9 +273,8 @@ class Template:
"""Stores the keyword arguments for later object creation."""
# Allow the updating of template arguments whilst still in template form
super().__init__()
self._arguments = arguments
empty_dict = {} # type: Dict[str, Any]
self._vol = collections.ChainMap(empty_dict, self._arguments, {'type_name': type_name})
self._vol = collections.ChainMap(empty_dict, arguments, {'type_name': type_name})
@property
def vol(self) -> ReadOnlyMapping:
+2 -2
View File
@@ -23,8 +23,8 @@ class ObjectTemplate(interfaces.objects.Template):
"""
def __init__(self, object_class: Type[interfaces.objects.ObjectInterface], type_name: str, **arguments) -> None:
arguments['object_class'] = object_class
super().__init__(type_name = type_name, **arguments)
self._arguments['object_class'] = object_class
proxy_cls = self.vol.object_class.VolTemplateProxy
for method_name in proxy_cls._methods:
@@ -43,7 +43,7 @@ class ObjectTemplate(interfaces.objects.Template):
return self.vol.object_class.VolTemplateProxy.children(self)
def relative_child_offset(self, child: str) -> int:
"""Returns the relative offset of a child of the templated object (see
"""Returns the relative offset of a child of the templated object (see
:class:`~volatility.framework.interfaces.objects.ObjectInterface.VolTem
plateProxy`)"""
return self.vol.object_class.VolTemplateProxy.relative_child_offset(self, child)