Skip to content

Commit

Permalink
sdk/python: Memory usage optimization for ObjectFile
Browse files Browse the repository at this point in the history
Signed-off-by: Aaron Wilson <[email protected]>
  • Loading branch information
aaronnw committed Sep 23, 2024
1 parent 78dd6c6 commit e804411
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion python/aistore/sdk/object_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ def read(self, size: int = -1) -> bytes:
if size < 0 or size > len(self):
size = len(self)

data = self._buffer[self._pos : self._pos + size]
data = memoryview(self._buffer)[self._pos : self._pos + size]
# Use len(data) instead of `size` -- Buffer may not contain that much data
self._pos += len(data)
return bytes(data)

Expand Down

0 comments on commit e804411

Please sign in to comment.