-
For an upcoming meetup I'd like to be able to show the memory benefits that come from libvips. I'm using A follow-up question: Is there a function I can call to get the memory high-water mark at runtime? (and thread count too if possible). My example code is: kip@Kips-MacBook-Pro image % VIPS_LEAK=1 iex -S mix
Erlang/OTP 26 [erts-14.2] [source] [64-bit] [smp:10:10] [ds:10:10:10] [async-threads:1] [jit] [dtrace]
Interactive Elixir (1.16.2) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> i = Image.thumbnail! "./test/support/images/Kamchatka-2019-8754.jpg", 200
%Vix.Vips.Image{ref: #Reference<0.3808751778.2887122972.162784>}
iex(2)> Image.write i, "/tmp/nothing.jpg"
{:ok, %Vix.Vips.Image{ref: #Reference<0.3808751778.2887122972.162784>}}
iex(3)> %
kip@Kips-MacBook-Pro image % I'm expecting to see the VIP_LEAK debug message after a clean shutdown which I am doing with CTRL-\ I know kip@Kips-MacBook-Pro image % vips --version
vips-8.15.2
vips_threadset_free: peak of 0 threads
memory: high-water mark 0 bytes Any help or suggestions welcome! |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments
-
I tried just running a script to see if that might avoid an I wonder if there is a possibility to add a NIF api call to Additionally I wonder if somehow How would I go about compiling |
Beta Was this translation helpful? Give feedback.
-
@kipcole9 did you nuke the You can check if vix is using prebuilt libvips or not using
When compiled against platform libvips then it would look like this
|
Beta Was this translation helpful? Give feedback.
-
@akash-akya, all good on that part. I was just trying to say that I can't get any output when I invoke with Basically, I'm just trying to get the memory high water mark for libvips. And I'd be super happy if there was a NIF interface to |
Beta Was this translation helpful? Give feedback.
-
@kipcole9 can you try the latest example.exs :ok = Vix.Vips.set_vips_leak_checking(true)
## Code
{:ok, _im} = Vix.Vips.Image.new_from_file("test/images/puppies.jpg")
:ok = Vix.Nif.nif_vips_shutdown() Run the script
Unfortunately it is hard to make it work with |
Beta Was this translation helpful? Give feedback.
-
@akash-akya, that's extremely kind of you and I'm sorry to cause more work for you on something that probably only I care about. I will give it a spin. I'm still not sure why I was looking at the size_t
vips_tracked_get_mem_highwater(void)
size_t
vips_tracked_get_mem(void) That would be great to have those as NIF calls if it's at all possible because then I can graph memory usage over time in a Livebook. What do you think? |
Beta Was this translation helpful? Give feedback.
-
Hey @kipcole9, sorry for the delay. I added those two function under
I haven't checked yet, but I think that logic only exists in
No It is not like that. I am happy that you actively raise issues/discussions, which is needed to improve the library. |
Beta Was this translation helpful? Give feedback.
@akash-akya, that's extremely kind of you and I'm sorry to cause more work for you on something that probably only I care about. I will give it a spin. I'm still not sure why
VIPS_LEAK=1 ......
doesn't trigger this but it's time to move on.I was looking at the
libvips
code and I seeThat would be great to have those as NIF calls if it's at all possible because then I can graph memory usage over time in a Livebook. What do you think?