This gist contains the files to demonstrate the problem described in p5.serialserver leaking memory.
To run this, you'll need an "Arduino-like device" with a USB port capable of generating
| // Efficiently maintain source => target associations. | |
| // R. Dunbar Poor - March 2020 | |
| var Association = function() { | |
| this._links_by_source = new Map(); | |
| this._links_by_target = new Map(); | |
| } | |
| /** | |
| * @brief Clear all associations |
This gist contains the files to demonstrate the problem described in p5.serialserver leaking memory.
To run this, you'll need an "Arduino-like device" with a USB port capable of generating
| license: gpl-3.0 |
| // Walk a tree using Promises, where the act of fetching a node is asynchronous. | |
| // | |
| // This version visits the nodes in the expected order and returns a promise that | |
| // is resolved when the last node is visited. (If you're here from the StackOverflow | |
| // post, the original error was a missing return statement in the call to map()) | |
| "use strict"; | |
| var family_tree = { | |
| "pops" : { name: "pops", children: ["chuck", "george", "pete"]}, |
| Summary: a "standard build" of ruby-2.0.0-p0 under Mac OS X 10.8.3, | |
| fails with an abort trap while linking miniruby | |
| Compilation environment: | |
| MacBook Pro | |
| OS X 10.8.3 | |
| Xcode version 4.6.1 with command line tools | |
| gcc version 4.2.1 (Based on Apple Inc. build 5658) | |
| Commands: |
| FactoryGirl.define do | |
| # generate a sequence of fake US street addresses, such as: | |
| # 1001 Birch Boulevard, Clinton AK 52574, USA | |
| sequence :address do |n| | |
| # NB: the length of street_name, street_type, city, state arrays | |
| # are all chosen to be relatively prime to generate maximal | |
| # length sequences | |
| street_number = 1000 + n | |
| street_name = %w(Aspen Birch Cedar Dogwood Elm Ginkgo Hickory Ironwood |
| FactoryGirl.define do | |
| # Generate a fake name by composing a first and last name. Names | |
| # taken from recent US Census lists. | |
| sequence :name do |n| | |
| first_names = %w( Aaron Abby Abdul Abe Abel Abigail Abraham Abram | |
| Ada Adalberto Adam Adan Addie Adela Adele Adeline Adolfo Adolph | |
| Adrian Adriana Adrienne Agnes Agustin Ahmad Ahmed Aida Aileen | |
| Aimee Aisha Al Alan Alana Alba Albert Alberta Alberto Alden Aldo |
| load '../sketches/datetime_bug.rb' | |
| -- create_table(:test_records, {:force=>true}) | |
| NOTICE: CREATE TABLE will create implicit sequence "test_records_id_seq" for serial column "test_records.id" | |
| NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "test_records_pkey" for table "test_records" | |
| [1m[36m (237.7ms)[0m [1mCREATE TABLE "test_records" ("id" serial primary key, "f_datetime" timestamp) [0m | |
| -> 0.3416s | |
| [1m[35m (0.3ms)[0m BEGIN | |
| [1m[36mSQL (39.4ms)[0m [1mINSERT INTO "test_records" ("f_datetime") VALUES ($1) RETURNING "id"[0m [["f_datetime", Wed, 14 Sep 0763 00:00:00 UTC +00:00]] | |
| [1m[35m (0.8ms)[0m COMMIT | |
| [1m[36mDateTimeBug::TestRecord Load (0.5ms)[0m [1mSELECT "test_records".* FROM "test_records" LIMIT 1[0m |