File: example2.rb

package info (click to toggle)
ruby-vips 2.1.4-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 5,164 kB
  • sloc: ruby: 3,530; makefile: 3
file content (34 lines) | stat: -rwxr-xr-x 561 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/ruby

require "logger"
require "vips"

puts ""
puts "starting up:"

# this makes vips keep a list of all active objects which we can print out
Vips.leak_set true

# disable the operation cache
Vips.cache_set_max 0

# GLib::logger.level = Logger::DEBUG

n = 10000

n.times do |i|
  puts ""
  puts "call #{i} ..."
  out = Vips::Operation.call "black", [200, 300]
  if out.width != 200 || out.height != 300
    puts "bad image result from black"
  end
end

puts ""
puts "after #{n} calls:"
GC.start
Vips::Object.print_all

puts ""
puts "shutting down:"