Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
ff82e5e4
Commit
ff82e5e4
authored
Apr 27, 2015
by
Adam Palay
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
do garbage collection when dumping memory
parent
6167b03e
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
2 deletions
+21
-2
openedx/core/operations.py
+21
-2
No files found.
openedx/core/operations.py
View file @
ff82e5e4
import
os
import
signal
import
tempfile
import
gc
from
datetime
import
datetime
from
meliae
import
scanner
def
dump_memory
(
signum
,
frame
):
"""Dump memory stats for the current process to a temp directory. Uses the meliae output format."""
scanner
.
dump_all_objects
(
'{}/meliae.{}.{}.dump'
.
format
(
tempfile
.
gettempdir
(),
datetime
.
now
()
.
isoformat
(),
os
.
getpid
()))
"""
Dump memory stats for the current process to a temp directory.
Uses the meliae output format.
"""
timestamp
=
datetime
.
now
()
.
isoformat
()
format_str
=
'{}/meliae.{}.{}.{{}}.dump'
.
format
(
tempfile
.
gettempdir
(),
timestamp
,
os
.
getpid
(),
)
scanner
.
dump_all_objects
(
format_str
.
format
(
'pre-gc'
))
# force garbarge collection
for
gen
in
xrange
(
3
):
gc
.
collect
(
gen
)
scanner
.
dump_all_objects
(
format_str
.
format
(
"gc-gen-{}"
.
format
(
gen
))
)
def
install_memory_dumper
(
dump_signal
=
signal
.
SIGPROF
):
...
...
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