Flash How do flush or empty netstream buffer - actionscript-3

I'm experiencing an issue with a 20 video Flash project. We're calling the videos from a local source, and FLVPlayback is opening netstreams and generating this huge Uncategorized chunk of memory. Upon further inspection, it turns out that it's a large amount of netstream buffers. How do I empty these buffers?
I've found this NetStream.Buffer.Empty but I'm not sure how to properly use it.

Instead of using close(); I used dispose(); to stop, close, and flush the NetStream buffer. Many thanks to #batman
netStream.dispose()

Related

Is there is memory limitation to seek play flash Audio player AS3?

Flash Audio Player: I have an audio file which is 6 hours long, i am not able to seek audio beyond (03:22:54) is there is memory limitation to seek play beyond this 12173943 milliseconds?
Apparently, some kind of limitation exists. AS3 fails to seek past 12173943 milliseconds, while AS2 does seek past this point, but with less precision. See this question on SO for further details. I'm not aware of any workaround barring splitting the file into chunks smaller than 12000 seconds.

Do I Have a Memory Leak / Garbage Collection Bug?

I'm building an Air application, which, due to the workflow of the animators, needs to load a lot of external swf files.
I load them all via FileStream / Loader Objects at the boot process and then store them in an object for further use.
The instant they get loaded, I use a gotoAndStop(1) command to make them stop looping (the original files have no scripts whatsoever).
After the load process I can see the system memory go slowly but consistently up.
When I manually invoke Garbage Collection with the System.gc() command,
the memory gets cleared again.
If I let the application run for hours it seems the Garbage Collector does not run.
Any ideas what the problem might be? Or should I just forget about it and just occasionally run System.gc() manually?
Thanks a lot!
The Garbage Collector will only run when it needs to, so it is entierly possible that it would go a very long time before running (especially if you have a lot of RAM available).
The important thing is the memory is cleared when it is run. This tells me that you don't have a leak, as it can be cleared up.
Also, how are you measuring the system memory? If you are doing it through Task Manager those numbers aren't really to be relied upon.
I recommend Process Explorer . Monitor the 'Private Bytes' column instead.

Flash Embedded FLV Memory Leak

I am making a game where I have several small character MovieClips which appear on screen randomly. There can be several characters of the same type, and when they are removed from the stage I store them in a memory pool to reuse them.
These characters have several different keyframes which I call to make them do specific things, like fly, land, etc. To improve performance flvs were made for their different actions and these have been embedded in the timeline.
I am having a problem where the amount of memory assigned to Video is constantly increasing as the game is played, even though I am not making more instances of the characters. I have been researching into garbage collecting video but all the stuff I find is for when using the FLVPlayback component and I haven't found anything helpful.
Does anyone have any ideas?
Thanks!
How much is your memory increasing? If it's starting at ie. 80 MB and slowy increasing ie. to 140, and then either staying there or decreasing to 120 and again going slightly up, then there's no need to worry. Unfortunately that's how the Flash GC works. Even if you're not leaking any memory it will slowly show memory increase (and then sudden bob down, as the GC collects trash, and again slowly up).
However, it could be also that you have a real memory leak, but for that to assess, you'd need to post some code. Btw, using memory-pools is a great idea in games, good you're doing it already.

How to set buffer settings in flex?

How should i bring buffer settings in flex swf? How i achieve buffer setting in flex.
for example:
I use below code to set buffer time with netstream
ns.bufferTime=0;
But the delay in playback varies after some time.I want only a constant delay throughout the playback.
Because I want to set buffertime and all buffersetting of my own in actionscript and testing it to find the delay in playback the video.I want to set the delay time in playback video using buffertime.
Help me plz....
You should take into consideration connection time. Your application connects to the server. And you cannot control this time by ActionScript in particular by bufferTime. You should tune the server.
You're removing the buffer time -- it would be better to set a buffer time to say, 3 seconds or so. This will help with "hiccups".
ns.bufferTime = 3.0;
The standard is around 3+ seconds. I actually prefer a higher buffer time for larger movies.

Will the memory rise if I loads a same URL for 1000 times in Adobe AIR?

Here is the case: I have created a test application which simply loops to load a same url for 1000 times by using HTMLLoader class from Adobe AIR. What I found is that the memory of this app keeps rising.
So is this expected? I mean it's the same URL although it get loaded for 1000 times. Does the AVM create 1000 objects behind the scene?
It would depend on how many of the objects you keep references to, and on how many of them are available for garbage collection. It can also depend on whether or not the player decides to trigger a mark-sweep of the garbage collector (which sometimes depends on external issues like how much total memory is available from the OS).
What if you used the component and just set the url parameter to "" followed by the url again in a callLater?
Pretty sure memory wouldn't build up that way.