Skip to content

Instantly share code, notes, and snippets.

@vincentwoo
Created December 28, 2014 21:35
Show Gist options
  • Save vincentwoo/756b65ae09a13b2842a0 to your computer and use it in GitHub Desktop.
Save vincentwoo/756b65ae09a13b2842a0 to your computer and use it in GitHub Desktop.
heapdump = require 'heapdump'
docker = new (require('dockerode'))(socketPath: '/var/run/docker.sock')
createContainer = (cb) ->
docker.createContainer {
Cmd: '/bin/bash'
Image: 'ubuntu:12.04'
}, (err, container) ->
container.remove {force: true}, cb
createContainers = (n, cb) ->
seen = 0
for i in [1..n]
setTimeout createContainer, i * 50, ->
seen++
cb() if seen == n
createContainers 100, ->
heapdump.writeSnapshot()
createContainers 10000, ->
heapdump.writeSnapshot()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment