Skip to content

Instantly share code, notes, and snippets.

@sporto
Created September 4, 2013 05:55
Show Gist options
  • Save sporto/6433197 to your computer and use it in GitHub Desktop.
Save sporto/6433197 to your computer and use it in GitHub Desktop.
Go - Node - Memory usage
package main
import "net/http"
func main() {
bytes := make([]byte, 1024*1024)
for i := 0; i < len(bytes); i++ {
bytes[i] = 100
}
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
w.Write(bytes)
})
http.ListenAndServe(":8100", nil)
}
var http = require('http')
var Buffer = require('buffer').Buffer;
var n = 1024*1024;
var b = new Buffer(n);
for (var i = 0; i < n; i++) b[i] = 100;
http.createServer(function (req, res) {
res.writeHead(200);
res.end(b);
}).listen(8100);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment