Git Product home page Git Product logo

coco's People

Contributors

kentdlee avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

coco's Issues

GC memory by Recycler reference counting

CoCo don't have garbage collection currently, so we have memory leak.

The PyObject.refCount may help if we call incRef,decRef when we need copy or delete PyObject.
But if we have circular reference, refCount won't work.
So we need GC strategy which can handle circular references. I'm trying to use Recycler:

[1] "A Pure Reference Counting Garbage Collector", 2001, Bacon, D. F., Attanasio, C. R., Rajan, V. T., Smith, S. E., & LEE, H.

https://github.com/thrunduil/cyclic_rc

#include "cyclic_rc/shared_ptr.h"

class PyObject;
using PyObjectPtr = cyclic_rc::shared_ptr<PyObject, false>;

class PyObject : public cyclic_rc::cyclic_rc_base<false> {
 public:
  PyObject();
  virtual ~PyObject();
  virtual void visit_children(int t) override {}
  PyObjectPtr callMethod(PyObjectPtr& my_ptr, string name, vector<PyObjectPtr>* args);
  ...
};

class PyList : public PyObject {
 public:
  void visit_children(int t) override {
    for (auto &i : data) {
      i.visit_children(t);
    }
  }

 protected:
  vector<PyObjectPtr> data;
};

Built-In Print Problem

The built-in print function does not process strings right now for tabs, newlines, and other escape sequences like the other print functions do. This needs to be corrected. Probably should put the process string function in the util module.

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.