Coder Social home page Coder Social logo

python-bem's Introduction

python-bem's People

Contributors

arhibot avatar daevaorn avatar freevoid avatar generalov avatar un1t avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

python-bem's Issues

Memory leaks when evaluating JS code

Hi, this is more PyV8 issue, but I want to know your experience.

After rendering js file (about 300kb) and exiting context, PyV8 doesn't free memory. This is code demonstration.

import os, gc
import PyV8
def get_mem():
    a = os.popen('ps -p %d -o %s | tail -1' % (os.getpid(),"vsize,rss,pcpu")).read()
    a = a.split()
    return (int(a[0]), int(a[1]))

def main():
    js_code = open('bem/touch.bundles/rubric/rubric.xml.js', 'r').read().decode('utf-8')

    for i in xrange(10**5):
        with PyV8.JSContext() as ctx:
            ctx.eval(js_code)
        if i % 10000:
            PyV8.JSEngine.collect()
            gc.collect()
            print get_mem()

if __name__ == "__main__":
    main()

Output:

(744060, 20432)
(745880, 21792)
(746904, 22268)
(746904, 22572)
...
(2176496, 1061752)
(2176496, 1062116)
Traceback (most recent call last):
  File "v8test.py", line 22, in <module>
    main()
  File "v8test.py", line 15, in main
    ctx.eval(js_code)
PyV8.JSError: JSError: <CALL_AND_RETRY_LAST> Allocation failed - process out of memory

Do you use python-bem in production?
Do you have such problem?
Does PyV8 leak with django object?
Which version of PyV8, V8 do you use?

Thank you in advance for any help.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.