-
-
Notifications
You must be signed in to change notification settings - Fork 646
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Memory leak with VImage::text() , vips-8.8.4 #1508
Comments
Wow, I see terrible memory behaviour here too. Thanks, I'll investigate. |
I see the problem with this simpler program: /* compile with
*
* g++ -g -Wall text.cpp `pkg-config vips-cpp --cflags --libs`
*/
#include <iostream>
#include <string>
#include <vips/vips8>
using namespace std;
using namespace vips;
int
main (int argc, char* argv[])
{
if (VIPS_INIT ("vips_test1"))
vips_error_exit ("can not init vips");
// turn off the operation cache, or we'll just run the text once
vips_cache_set_max (0);
//string txt = "积蓄了眼睛的疲劳使之恢复精神! ・舒适的蒸汽持续约12分钟";
string txt = "Hello, world!";
for (int i = 0; i < 1000; i++) {
cout << "iteration " << i << endl;
auto tmp_p = txt.c_str();
VImage t_img = VImage::text(tmp_p, VImage::option ()->
set ("width", 500)->
set ("height", 500));
}
// pause to watch the memory
string tmp;
cin >> tmp;
return 0;
} It gets to 2gb of memory by about 500 iterations with the English text (and by 50 iterations with the Chinese text). |
I am currently located to the stack: |
Yes, it looks like a Pango leak, or perhaps I'm misusing I'm planning to build pango myself and look in there. |
We were not unreffing PangoLayout. Thank you uint128! See #1508
Huh it was really simple, there was just a missing unref. Your example runs in a steady and small amount of memory for me now. Could you test with this patch? |
I have tested with the patch. The example and my other code works fine. |
That's great, thank you for reporting and testing this issue. This fix will be in 8.9.0, due in a few days. |
Firstly , thanks for the amazing library!
I am using vips-8.8.4.
When I using VImage::text() to draw some cjk unicode text to new image, the resident memory by the process increases rapidly, and never decrease.
For the example in attach, the process used about 5G memory.
Another strange point is that the resident memory by the process can go much bigger than the total used memory show by top command, as showing in the screen shot below:
text_to_draw.txt
The text was updated successfully, but these errors were encountered: