mirror of
https://github.com/volatilityfoundation/volatility3.git
synced 2026-09-07 18:27:39 +02:00
Core: Half the memory usage by not storing arguments
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user