Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Richard
erp5
Commits
ee0494ae
Commit
ee0494ae
authored
Sep 24, 2013
by
Kazuhiko Shiozaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use pympler.asizeof.asizeof instead of mx.Tools.sizeof to get more accurate memory usage.
parent
0470ee54
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
11 deletions
+9
-11
product/ERP5Type/CachePlugins/RamCache.py
product/ERP5Type/CachePlugins/RamCache.py
+9
-11
No files found.
product/ERP5Type/CachePlugins/RamCache.py
View file @
ee0494ae
...
@@ -37,17 +37,15 @@ from Products.ERP5Type import interfaces
...
@@ -37,17 +37,15 @@ from Products.ERP5Type import interfaces
import
zope.interface
import
zope.interface
def
calcPythonObjectMemorySize
(
i
):
def
calcPythonObjectMemorySize
(
i
):
""" Recursive function that will 'walk' over complex python types and caclulate
"""
their RAM memory usage. """
Returns the memory size of an object.
from
mx.Tools
import
sizeof
(returns 0 if the required library is missing).
s
=
sizeof
(
i
)
"""
if
isinstance
(
i
,
dict
):
try
:
for
k
,
v
in
i
.
items
():
from
pympler.asizeof
import
asizeof
s
+=
calcPythonObjectMemorySize
(
k
)
+
calcPythonObjectMemorySize
(
v
)
return
asizeof
(
i
)
elif
isinstance
(
i
,
(
list
,
tuple
)):
except
ImportError
:
for
v
in
i
:
return
0
s
+=
calcPythonObjectMemorySize
(
v
)
return
s
_MARKER
=
[]
_MARKER
=
[]
class
RamCache
(
BaseCache
):
class
RamCache
(
BaseCache
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment