Click here to Skip to main content
16,016,165 members
Home / Discussions / C#
   

C#

 
GeneralRe: float calculation issue (decimal is no solution) Pin
George_George4-Jun-08 22:22
George_George4-Jun-08 22:22 
GeneralRe: float calculation issue (decimal is no solution) Pin
The Nightcoder4-Jun-08 23:01
The Nightcoder4-Jun-08 23:01 
GeneralRe: float calculation issue (decimal is no solution) Pin
George_George4-Jun-08 23:27
George_George4-Jun-08 23:27 
GeneralRe: float calculation issue (decimal is no solution) Pin
The Nightcoder5-Jun-08 4:01
The Nightcoder5-Jun-08 4:01 
GeneralRe: float calculation issue (decimal is no solution) Pin
George_George5-Jun-08 14:48
George_George5-Jun-08 14:48 
QuestionThreadpool Synchronization causing out of memory error Pin
sumathi pandarinathan26-May-08 0:12
sumathi pandarinathan26-May-08 0:12 
AnswerRe: Threadpool Synchronization causing out of memory error Pin
leppie26-May-08 4:03
leppie26-May-08 4:03 
GeneralRe: Threadpool Synchronization causing out of memory error Pin
sumathi pandarinathan26-May-08 21:09
sumathi pandarinathan26-May-08 21:09 
Hi,
i have found the line which is causing out of memory error.
please find the below program and it working similar my application.

namespace ConsoleApplication1
{
/// <summary>
/// Summary description for Class1.
/// </summary>
///
class testclass
{
public void show(Object O)
{
Console.WriteLine("Welcome to C#", "TestClass1 Object");
}
}

class testclass1
{
public void show(Object O)
{
Console.WriteLine("Welcome to ThreadPool", "TestClass2 Object");
}
}
class Example
{

static int CountDown= 20;

public static void WaitToShow(Object Obj, bool signaled)
{

if (Obj != null)
Console.WriteLine(CountDown--);
}
}

class Class1
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args)
{
//
// TODO: Add code to start application here
//
//AutoResetEvent MyEvent = new AutoResetEvent(false);

ManualResetEvent MyEvent = new ManualResetEvent(false);
testclass t1 = new testclass();
testclass1 t2 = new testclass1();

ThreadPool.RegisterWaitForSingleObject(MyEvent, new WaitOrTimerCallback(Example.WaitToShow),t1,40,false);
//ThreadPool.QueueUserWorkItem(new WaitCallback(t1.show));
//ThreadPool.QueueUserWorkItem(new WaitCallback(t2.show));

MyEvent.Set();


Console.WriteLine("****CountDown Program******");
Thread.Sleep(10000);
Console.ReadLine();
}

} // end clas

}


In the above example program, i commented the line " MyEvent.Set();" and doesn't gave me out of memory error. but if i didn't comment it then the appliaction getting crashed.
Actually i need to set manualresetevent, since the performance is very good.

please suggest me any solution for how to avoid increasing memory when i set manualresetevent.

Thanks.
Sumathi
Questionfolderbrowserdialog Pin
huotari25-May-08 23:57
huotari25-May-08 23:57 
AnswerRe: folderbrowserdialog Pin
Dario Solera26-May-08 0:18
Dario Solera26-May-08 0:18 
AnswerRe: folderbrowserdialog Pin
D i x y26-May-08 0:56
D i x y26-May-08 0:56 
QuestionFix an error 'Page can not be displayed' for file upload control when uploading more than 10mb file size Pin
kishoregani25-May-08 23:30
kishoregani25-May-08 23:30 
AnswerRe: Fix an error 'Page can not be displayed' for file upload control when uploading more than 10mb file size Pin
Dario Solera26-May-08 0:21
Dario Solera26-May-08 0:21 
GeneralRe: Fix an error 'Page can not be displayed' for file upload control when uploading more than 10mb file size Pin
Vasudevan Deepak Kumar26-May-08 19:18
Vasudevan Deepak Kumar26-May-08 19:18 
QuestionHow to get the row/column/data of cells selected in worksheet of Excel using C# Pin
Varad_Rajan25-May-08 23:25
Varad_Rajan25-May-08 23:25 
AnswerRe: How to get the row/column/data of cells selected in worksheet of Excel using C# Pin
leppie26-May-08 4:05
leppie26-May-08 4:05 
QuestionDetecting if a key is pressed outside the key events Pin
Christian Wikander25-May-08 23:24
Christian Wikander25-May-08 23:24 
AnswerRe: Detecting if a key is pressed outside the key events Pin
Roger Alsing26-May-08 0:55
Roger Alsing26-May-08 0:55 
AnswerRe: Detecting if a key is pressed outside the key events Pin
Ed.Poore26-May-08 0:55
Ed.Poore26-May-08 0:55 
GeneralRe: Detecting if a key is pressed outside the key events Pin
Christian Wikander26-May-08 1:28
Christian Wikander26-May-08 1:28 
QuestionConsole.WriteLine Pin
George_George25-May-08 23:21
George_George25-May-08 23:21 
AnswerRe: Console.WriteLine Pin
Colin Angus Mackay25-May-08 23:51
Colin Angus Mackay25-May-08 23:51 
GeneralRe: Console.WriteLine Pin
George_George26-May-08 0:01
George_George26-May-08 0:01 
AnswerRe: Console.WriteLine Pin
DaveyM6925-May-08 23:53
professionalDaveyM6925-May-08 23:53 
GeneralRe: Console.WriteLine Pin
George_George26-May-08 0:02
George_George26-May-08 0:02 

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.