Skip to content

Commit 3b723f8

Browse files
committed
Linux pagecache.Files: Memory Usage
Converts `objects.Pointer` to `int` before storing them in the set. This should have a substantial impact on memory, similar to those in #1758
1 parent df03d22 commit 3b723f8

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

volatility3/framework/plugins/linux/mountinfo.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,9 +279,9 @@ def get_superblocks(
279279
if not (sb_ptr and sb_ptr.is_readable()):
280280
continue
281281

282-
if sb_ptr in seen_sb_ptr:
282+
if int(sb_ptr) in seen_sb_ptr:
283283
continue
284-
seen_sb_ptr.add(sb_ptr)
284+
seen_sb_ptr.add(int(sb_ptr))
285285

286286
superblock = sb_ptr.dereference()
287287

volatility3/framework/plugins/linux/pagecache.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -204,10 +204,10 @@ def _walk_dentry(
204204
if dentry_addr == root_dentry.vol.offset:
205205
continue
206206

207-
if dentry_addr in seen_dentries:
207+
if int(dentry_addr) in seen_dentries:
208208
continue
209209

210-
seen_dentries.add(dentry_addr)
210+
seen_dentries.add(int(dentry_addr))
211211

212212
inode_ptr = dentry.d_inode
213213
if not (inode_ptr and inode_ptr.is_readable()):
@@ -283,9 +283,10 @@ def get_inodes(
283283
continue
284284

285285
# Inode already processed?
286-
if root_inode_ptr in seen_inodes:
286+
if int(root_inode_ptr) in seen_inodes:
287287
continue
288-
seen_inodes.add(root_inode_ptr)
288+
289+
seen_inodes.add(int(root_inode_ptr))
289290

290291
root_path = mountpoint
291292

@@ -318,9 +319,9 @@ def get_inodes(
318319
continue
319320

320321
# Inode already processed?
321-
if file_inode_ptr in seen_inodes:
322+
if int(file_inode_ptr) in seen_inodes:
322323
continue
323-
seen_inodes.add(file_inode_ptr)
324+
seen_inodes.add(int(file_inode_ptr))
324325

325326
if follow_symlinks:
326327
file_path = cls._follow_symlink(file_inode_ptr, file_path)

0 commit comments

Comments
 (0)