ruby 内存泄漏 Gdk::PixbufLoader

发布于 2024-09-05 13:09:07 字数 433 浏览 3 评论 0原文

所以我开始想知道 ruby​​1.8.6 的 gnome2 库有多么漏洞。

#!/usr/bin/env ruby
require 'gtk2'
while true
   sleep 0.1
   pixbuf = Gdk::PixbufLoader.new
   pixbuf = nil
end

根据 watch -n 1 ps -o rss -p,这会泄漏大约 16kb/sec

如果您开始尝试使用以下命令向其中写入一大块图像数据,情况会变得更加复杂pixbuf.last_write img_data

有什么想法可以解决这个问题(以及第二个问题)吗?我需要更新代码中的图像数据,但似乎任何最终使用 pixbuf 的东西都会像筛子一样泄漏。

So I'm beginning to wonder how leaky the gnome2 libraries for ruby1.8.6 are.

#!/usr/bin/env ruby
require 'gtk2'
while true
   sleep 0.1
   pixbuf = Gdk::PixbufLoader.new
   pixbuf = nil
end

this leaks about 16kb/sec according to watch -n 1 ps -o rss -p <process id>

This is compounded if you start trying to write a chunk of large chunks of image data to it using pixbuf.last_write img_data

Any ideas how to get around this (and the second issue)? I need to update image data within my code but it seems like anything that ends up using a pixbuf leaks like a sieve.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文