• SEARCH
  • DOWNLOADS
  • MY ACCOUNT
  • Buy (0)
  • CONTACT
  • Free Trial
Wowza Logo
  • PRODUCTS
  • DEVELOPER
  • SOLUTIONS
  • PRICING
  • RESOURCES
  • SUPPORT
  • My Account
  • Buy (0)
  • SEARCH
  • Ask a question
  • Forums
    • Wowza ClearCaster Pro
    • Wowza Streaming Engine
    • Wowza Streaming Cloud
    • Wowza Player
    • Wowza GoCoder SDK
    • Wowza Developer Dojo
    • Topics
    • Questions
    • Articles
    • Users
    • Badges
  • Sign in
  • Community Home /
  • Wowza Developer Dojo /
  • Wowza Streaming Server Java API /
avatar image
Question by Stream Toolbox · Sep 20, 2014 at 05:20 PM · wowza streaming server java api

Is it necessary to remove manually the IMediaStreamActionNotify from the stream?

Hi,

I have found an example in which an instance of IMediaStreamActionNotify is attached to a stream. In that code there is a code snippet like this:

public void onStreamDestroy(IMediaStream stream) {
		IMediaStreamActionNotify actionNotify = null;
		WMSProperties props = stream.getProperties();
		synchronized(props)
		{
			actionNotify = (IMediaStreamActionNotify)stream.getProperties().get("streamActionNotifier");
		}
		if (actionNotify != null)
		{
			stream.removeClientListener(actionNotify);
		}
	}


Question: if the stream is going to be destroyed, is it really necessary to manually remove this listener? I have never seen any API where this was necessary in order to prevent memory leak. In the generated javadoc that is usually referred to as server side API documentation, I haven't found any info about this. :-)

Can you tell it to me? Thanks!
Comment

People who like this

0 Show 0
10 |600 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image

Answer by Andrew Kennedy · Sep 23, 2014 at 04:24 AM

Hi,

It best practice where possible to remove any objects used in a connection prior to it shutting down. Keeping track of objects used is an important element when writing any code, regardless of language used.

Andrew.
Comment

People who like this

0 Show 1 · Share
10 |600 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Stream Toolbox · Sep 25, 2014 at 04:21 PM 0
Share
Ok, so if we are supposed to do this, that means behind the scenes the IMediaStream object is not garbage collected along with its properties when the client is disconnected. Otherwise we could rely on the GC. Does that mean it's not safe to expect that a fresh IMediaStream's properties might contain outdated garbage data from previous cycles?

Thanks!
avatar image

Answer by Shoo Kyuk Wei · Oct 08, 2014 at 05:22 PM

lol good question :D u probably can see memory leak if it doesn't. Waiting for ur finding!
Comment

People who like this

0 Show 0 · Share
10 |600 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

1 Person is following this question.

avatar image

Related Questions

Module to disconnect idle client connections after timeout period 1 Answer

Stream class stream controller 22 Answers

StreamNameAlias doesn't honor querystring 1 Answer

Getting absolute timecode 1 Answer

Automated LiveStreaM Record using Linux CLI,PHP and CRON 1 Answer

Hot Topics
  • Streaming Protocols
  • Wowza SDKs
  • AWS Hosting
  • Deployment Options
  • Load Balancing
  • Content Security
Product Sign-in
  • Wowza Streaming Cloud
  • Wowza Player
Under the Hood
  • Developer Tools
  • Wowza System Status
  • Test Players
  • Developer IDE
Partners
  • Partners Overview
  • Find a Reseller
  • Channel Partner Program
  • OEM Program
  • Wowza Reseller Portal
Company
  • About Us
  • Blog
  • News
  • Events
  • Careers
  • Customers
  • Contact Us
Stay Connected
Sign Up for Our Blog
Select a Language
  • English
    • English
    • Español
    • 日本語
    • 한국어
    • हिन्दी भाषा
    • 中文
    • русский язык

© 2005–2019 Wowza Media Systems, LLC. All rights reserved.   Terms | Privacy | Trademarks | Legal


Enterprise
Social Q&A

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Create an article
  • Forums
  • Wowza ClearCaster Pro
  • Wowza Streaming Engine
  • Wowza Streaming Cloud
  • Wowza Player
  • Wowza GoCoder SDK
  • Wowza Developer Dojo
  • Explore
  • Topics
  • Questions
  • Articles
  • Users
  • Badges