Due to an influx of spam, we have had to impose restrictions on new accounts. Please see this wiki page for instructions on how to get full permissions. Sorry for the inconvenience.
Admin message
The migration is almost done, at least the rest should happen in the background. There are still a few technical difference between the old cluster and the new ones, and they are summarized in this issue. Please pay attention to the TL:DR at the end of the comment.
I noticed when using the Play example, each "Play::new" will cause a memory leak.
Not sure why but my guess is that all resources aren't properly released upon drop.
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Child items ...
Show closed items
Linked items 0
Link issues together to show that they're related.
Learn more.
usegstreamer_play::{gst,Play,PlayMessage,PlayVideoRenderer};usestd::path::Path;fnplay_video(play:&Play,uri:&str){// Tell the player what uri to play.play.set_uri(Some(uri));play.play();letmutresult=Ok(());formsginplay.message_bus().iter_timed(gst::ClockTime::NONE){matchPlayMessage::parse(&msg){Ok(PlayMessage::EndOfStream)=>{play.stop();break;}Ok(PlayMessage::Error{error,details:_})=>{result=Err(error);play.stop();break;}Ok(_)=>{}Err(_)=>unreachable!(),}}result.unwrap()}fnmain(){gst::init().unwrap();letpath=std::env::args().skip(1).next().unwrap();leturl=url::Url::from_file_path(Path::new(&path).canonicalize().unwrap()).unwrap();loop{letplay=Play::new(None::<PlayVideoRenderer>);play.set_audio_track_enabled(false);play_video(&play,url.as_str());letstats=memory_stats::memory_stats().unwrap();println!("{} Mb",stats.physical_mem/1024/1024);}}
Just give some short video as an argument and let it loop a bit and the memory usage should increase on every loop.
EDIT:
I noticed that even if you only call play.set_uri(..) there is a small memory leak.
In this example, you will considered leaked the data created for the GLib type system, which is indeed never freed, but that is not a bug. I'd suggest to use valgrind and all the suppression files, or use the leak tracer (object only) instead.
If memory usage is increasing every loop then this is a different problem than what @ndufresne said. The statically allocated memory for GLib/GObject would stay the same after the first iteration.
Please run in a proper memory profiler to get some more hints about what is actually happening there. valgrind can tell you about actual leaks (after everything is dropped and you called gst::deinit()), heaptrack or massif could tell you about memory accumulating somewhere (and where).
You might also run into memory fragmentation (in that case all the tools above would not show any increase but the RSS of the process would increase), and setting G_SLICE=always-malloc and using a recent glibc (not glib!), or using a different allocator in place of malloc (tcmalloc, jemalloc, ...) should improve that situation.
Here is a valgrind report.
This is after running 10 loops and not playing but only using set_uri,
and after the loops i call gst::deinit().
Error leaked 4.1 kiB in 10 blocks Info at calloc at calloc (rtld-malloc.h:44) at allocate_dtv (dl-tls.c:375) at _dl_allocate_tls (dl-tls.c:634) at allocate_stack (allocatestack.c:430) at pthread_create@@GLIBC_2.34 (pthread_create.c:647) at unknown at g_thread_new at unknown at unknown at g_object_new_with_properties at g_object_new at gst_play_new at gstreamer_play::auto::play::Play::new (play.rs:31) at play::main (play.rs:43) Error leaked 16.0 kiB in 1 block Info at malloc at g_malloc at unknown at unknown at call_init.part.0 (dl-init.c:70) at call_init (dl-init.c:33) at _dl_init (dl-init.c:117) at unknown at unknown at unknown at unknown Summary Leaked 20.1 kiB total
Okay the one above can be ignored, ironically the memory_stats had a leak as well -_-.
So set_uri does Not leak it seems.
But for some reason i get Segmentation fault now after the run ends.
I basically got it the same as the example play.rs now, no matter if i run once or multiple times i get that error.
So must have messed something up, will report back once i got it solved and can get a valgrind report on the actual play memory leak.
How would i go about doing that?
I can debug it but not sure how to get a backtrace.
EDIT:
It seems to happen when breaking at PlayMessage::EndOfStream.
If i just stop the player and then break at PlayMessage::StateChanged (if state is Stopped) it doesn't cause a Segmentation fault oddly enough. Though that probably doesn't help much.
EDIT 2:
Okay it seems the memory leak triggers if you break on PlayMessage::EndOfStream (and it will cause Segmentation fault when the application exits i think.
Really odd..
EDIT 3:
Segmentation fault does not appear in a separate virtual ubuntu.
So it might be a WSL2 issue perhaps, though the memory leak occurs in when breaking at EndOfStream, will try bring a valgrind report from it.