fengzhao / fengzhao/pyv8

a python object/memory leak problem

Open
#244 0 comments 0 reactions 0 assignees View on GitHub
auto-migrated Priority-Medium Type-Defect
Dominant language
Python
Stars
0
Forks
0
PR merge metrics
No merged PRs in 30d

Description

```
What steps will reproduce the problem?
1. a simple python script below will reproduct the problem

import PyV8, gc, time, traceback

ctxt = None

class JSGlobal(PyV8.JSClass):
def add(self, x, y):
print x+y

gc_count = 0
def InitJS():
global ctxt
gc.disable()
if ctxt!=None:
return
ctxt = PyV8.JSContext(JSGlobal())
ctxt.enter()
# ExecuteJS( JAVASCRIPT_INIT )

def ExecuteJS(js):
global gc_count, ctxt
try:
gc_count += 1
if gc_count%100 == 0:
print 'GC!!!!\n'
print len(gc.get_objects())
gc.collect()
PyV8.JSEngine.collect()
print len(gc.get_objects())
ctxt.eval(js)
except:
print traceback.format_exc()

InitJS()

for i in range(1000):
ExecuteJS('add(1,2);')
time.sleep(0.01)

What is the expected output? What do you see instead?

every time the output of "len(gc.get_objects())" is increasing.
The gc process below is not working.
gc.collect()
PyV8.JSEngine.collect()
The memory usage is increasing too.
It seems that there is a object/memory leak problem.

What version of the product are you using? On what operating system?

linux + pyv8 r586

```

Original issue reported on code.google.com by `lxc...@gmail.com` on 3 May 2015 at 7:47

Attachments:
- [js.py](https://storage.googleapis.com/google-code-attachments/pyv8/issue-244/comment-0/js.py)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.