Click here to Skip to main content
15,895,370 members
Home / Discussions / C#
   

C#

 
QuestionCentralized exception handler and logger Pin
matixsc8-Oct-08 0:57
professionalmatixsc8-Oct-08 0:57 
AnswerRe: Centralized exception handler and logger Pin
Giorgi Dalakishvili8-Oct-08 1:14
mentorGiorgi Dalakishvili8-Oct-08 1:14 
AnswerRe: Centralized exception handler and logger Pin
matixsc8-Oct-08 2:16
professionalmatixsc8-Oct-08 2:16 
QuestionRe:Installing Flash player with windows set up Pin
RameshwerE8-Oct-08 0:19
RameshwerE8-Oct-08 0:19 
QuestionUpdate requires a valid UpdateCommand when passed DataRow collection with modified rows. [modified] Pin
astrovirgin7-Oct-08 23:36
astrovirgin7-Oct-08 23:36 
AnswerRe: Update requires a valid UpdateCommand when passed DataRow collection with modified rows. Pin
Giorgi Dalakishvili8-Oct-08 0:23
mentorGiorgi Dalakishvili8-Oct-08 0:23 
AnswerRe: Update requires a valid UpdateCommand when passed DataRow collection with modified rows. Pin
nelsonpaixao8-Oct-08 12:47
nelsonpaixao8-Oct-08 12:47 
QuestionProblem with free up memory! Pin
Ha ha ha ha ha ha ha ha7-Oct-08 23:24
Ha ha ha ha ha ha ha ha7-Oct-08 23:24 
Hi everybody,

I'm developing a network-based application. It is running on two stations. One station is sending 4separate & simultaneous voice streams
to the other station which in turn plays those streams. The problem is that memory consumption is high(4 MB/s) at the second station.
I've used Memoryobject.Dispose() to free up some memory but it seemed useless. Is there any other way to free up memory? Or am I using the Dispose method inappropriately?

Here is my code to play the sound streams:

<br />
private void Receive()<br />
        {<br />
            try<br />
            {<br />
                /*BufferDescription*/<br />
                BufferDescription playbackBufferDescription = new BufferDescription();<br />
                playbackBufferDescription.BufferBytes = waveFormat.AverageBytesPerSecond / 5;<br />
                playbackBufferDescription.Format = waveFormat;<br />
<br />
                bbStop = false;  <br />
                IPEndPoint remoteEP = new IPEndPoint(IPAddress.Any, 0);<br />
<br />
                byte[] byteData;<br />
                byte[] byteDecodedData;<br />
<br />
                /*While the voice stream is being recieved */<br />
                while (!bbStop)   <br />
                {<br />
		    //Receive data.<br />
		    byteData = udpClient.Receive(ref remoteEP);<br />
                    byteDecodedData = new byte[byteData.Length * 2];<br />
                    <br />
                    //I've used G711 for voice stream compression<br />
                    //G711 compresses the data by 50%, so I allocate a buffer of double<br />
                    //the size to store the decompressed data.<br />
                    //byteDecodedData = new byte[byteData.Length * 2];<br />
<br />
                    //Decompress data using the proper vocoder.<br />
                        ALawDecoder.ALawDecode(byteData, out byteDecodedData);<br />
<br />
                    //Play the data received to the user.<br />
                    playbackBuffer = new SecondaryBuffer(playbackBufferDescription, device);<br />
                    playbackBuffer.Write(0, byteDecodedData, LockFlag.None);<br />
                    playbackBuffer.Play(0, BufferPlayFlags.Default);<br />
<br />
                    first = false;<br />
                    //byteData = null;<br />
                    playbackBuffer=null;<br />
                    //byteDecodedData = null;<br />
                }<br />
                <big>playbackBuffer.Dispose();</big>   //Here is the problem! It doesn't work! :confused:<br />
            }<br />
            catch (Exception ex)<br />
            {<br />
                MessageBox.Show(ex.Message, "Error on Receive", MessageBoxButtons.OK, MessageBoxIcon.Error);<br />
            }<br />
            <br />
        }


Thanks in forward
AnswerRe: Problem with free up memory! Pin
Simon P Stevens8-Oct-08 0:11
Simon P Stevens8-Oct-08 0:11 
GeneralRe: Problem with free up memory! Pin
leppie8-Oct-08 1:53
leppie8-Oct-08 1:53 
GeneralRe: Problem with free up memory! Pin
Ha ha ha ha ha ha ha ha8-Oct-08 1:54
Ha ha ha ha ha ha ha ha8-Oct-08 1:54 
GeneralRe: Problem with free up memory! Pin
Simon P Stevens8-Oct-08 3:06
Simon P Stevens8-Oct-08 3:06 
GeneralRe: Problem with free up memory! Pin
Ha ha ha ha ha ha ha ha8-Oct-08 3:51
Ha ha ha ha ha ha ha ha8-Oct-08 3:51 
GeneralRe: Problem with free up memory! Pin
Simon P Stevens8-Oct-08 4:42
Simon P Stevens8-Oct-08 4:42 
GeneralRe: Problem with free up memory! Pin
DaveyM698-Oct-08 5:58
professionalDaveyM698-Oct-08 5:58 
GeneralRe: Problem with free up memory! Pin
Simon P Stevens8-Oct-08 22:58
Simon P Stevens8-Oct-08 22:58 
GeneralRe: Problem with free up memory! [modified] Pin
Mark Salsbery8-Oct-08 8:07
Mark Salsbery8-Oct-08 8:07 
GeneralRe: Problem with free up memory! Pin
Ha ha ha ha ha ha ha ha9-Oct-08 20:50
Ha ha ha ha ha ha ha ha9-Oct-08 20:50 
QuestionGet a whole column in a matrix Pin
xkrja7-Oct-08 21:37
xkrja7-Oct-08 21:37 
AnswerRe: Get a whole column in a matrix Pin
User 66587-Oct-08 21:48
User 66587-Oct-08 21:48 
QuestionHow to get whitespace in xml Pin
manju#1237-Oct-08 19:52
manju#1237-Oct-08 19:52 
AnswerRe: How to get whitespace in xml Pin
Pedram Behroozi7-Oct-08 20:18
Pedram Behroozi7-Oct-08 20:18 
GeneralRe: How to get whitespace in xml Pin
manju#1237-Oct-08 20:23
manju#1237-Oct-08 20:23 
GeneralRe: How to get whitespace in xml Pin
Pedram Behroozi7-Oct-08 20:29
Pedram Behroozi7-Oct-08 20:29 
GeneralRe: How to get whitespace in xml [modified] Pin
manju#1237-Oct-08 20:57
manju#1237-Oct-08 20:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.