Created
March 3, 2012 00:50
-
-
Save jasonmclaren/1963067 to your computer and use it in GitHub Desktop.
Demonstrate dbox memory leak
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# Remember to set DROPBOX_APP_KEY, DROPBOX_APP_SECRET, DROPBOX_AUTH_KEY, DROPBOX_AUTH_SECRET. | |
# This script assumes you're using Bundler to control your dbox version. | |
# You also need to set remote_dir below. | |
require "rubygems" | |
require "bundler" | |
Bundler.setup(:default) | |
Bundler.require(:default) | |
remote_dir='/this/dir/must/exist/on/dropbox' | |
local_dir='/tmp/dbox/mydir' | |
Dbox.clone(remote_dir, local_dir) if (!File.directory?(local_dir) || !Dbox.exists?(local_dir)) | |
loop do | |
begin | |
Dbox.push local_dir | |
Dbox.pull local_dir | |
rescue StandardError => e | |
puts "Dropbox error: #{e.message}" | |
else | |
memory_usage = `ps -o rss= -p #{Process.pid}`.to_i # in kilobytes | |
puts "memory_usage=#{memory_usage}k" | |
end | |
sleep 1 | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment