Skip to content

Instantly share code, notes, and snippets.

View stephenmathieson's full-sized avatar

Stephen Mathieson stephenmathieson

View GitHub Profile
$ valgrind --leak-check=full ./test
==5700== Memcheck, a memory error detector
==5700== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al.
==5700== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright info
==5700== Command: ./test
==5700==
# Test: parse_simple
OK
@stephenmathieson
stephenmathieson / typeof-vs-undefined.js
Created July 22, 2015 21:02
benchmarking `typeof x === "undefined"` vs `x === undefined`
var Benchmark = require('benchmark')
var Suite = Benchmark.Suite
var suite = new Suite;
suite.add('typeof this.src === "undefined"', function(){
typeof this.src === 'undefined'
})
@stephenmathieson
stephenmathieson / Makefile
Created March 10, 2015 14:27
NanThrowError & iojs 1.5.1
BIN := node_modules/.bin
GYP := $(BIN)/node-gyp
SRC = binding.cc
build: $(SRC) node_modules
$(GYP) rebuild
node_modules: package.json
@npm install
@touch $@
@stephenmathieson
stephenmathieson / output.txt
Last active August 29, 2015 14:16
curl over https leaking?
$ valgrind ./test
==17475== Memcheck, a memory error detector
==17475== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al.
==17475== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright info
==17475== Command: ./test
==17475==
==17475== Conditional jump or move depends on uninitialised value(s)
==17475== at 0x615D1D5: gnutls_session_get_data (in /usr/lib/x86_64-linux-gnu/libgnutls.so.26.21.8)
==17475== by 0x4E69125: ??? (in /usr/lib/x86_64-linux-gnu/libcurl-gnutls.so.4.2.0)
==17475== by 0x4E6971D: ??? (in /usr/lib/x86_64-linux-gnu/libcurl-gnutls.so.4.2.0)
@stephenmathieson
stephenmathieson / sophia-dev-ubuntu.txt
Created December 9, 2014 18:29
Sophia (dev branch) builds failing on Ubuntu
stephen@uklt:~/sophia$ uname -a
Linux uklt 3.13.0-32-generic #57-Ubuntu SMP Tue Jul 15 03:51:12 UTC 2014 i686 i686 i686 GNU/Linux
stephen@uklt:~/sophia$ make
SOPHIA v1.2
cc: cc
cflags: -g -DSR_INJECTION_ENABLE -O0 -std=c99 -pedantic -Wextra -Wall
cc rt/sr_crc.c
cc rt/sr_time.c
stephen@uklt:~/parson$ make
gcc -O0 -g -Wall -Wextra -std=c89 -pedantic-errors -o test tests.c parson.c
./test
(val = json_parse_file("tests/test_1_1.txt")) != NULL - OK
json_value_equals(json_parse_string(json_serialize_to_string(val)), val)- OK
(val = json_parse_file("tests/test_1_2.txt")) != NULL - OK
json_value_equals(json_parse_string(json_serialize_to_string(val)), val)- OK
(val = json_parse_file("tests/test_1_3.txt")) != NULL - OK
json_value_equals(json_parse_string(json_serialize_to_string(val)), val)- OK
(val = json_parse_file_with_comments("tests/test_1_1.txt")) != NULL - OK
stephen@uklt:~/parson$ uname -a
Linux uklt 3.13.0-32-generic #57-Ubuntu SMP Tue Jul 15 03:51:12 UTC 2014 i686 i686 i686 GNU/Linux
stephen@uklt:~/parson$ gcc --version
gcc (Ubuntu 4.8.2-19ubuntu1) 4.8.2
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
stephen@uklt:~/parson$ make test
gcc -O0 -g -Wall -Wextra -std=c89 -pedantic-errors -o test tests.c parson.c
./test
@stephenmathieson
stephenmathieson / foo.js
Created September 1, 2014 01:08
node 0.11.13 leaking memory?
console.log('hello')
diff --git a/.gitignore b/.gitignore
index 3c3629e..dd87e2d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,2 @@
node_modules
+build
diff --git a/Makefile b/Makefile
index 20f657b..5a517e2 100644
--- a/Makefile
/**
* Module dependencies.
*/
var builder = require('component-builder');
var resolve = require('component-resolver');
var consoler = require('component-consoler');
var log = consoler.log;
var fatal = consoler.fatal;