Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / March 2005

Tip: Looking for answers? Try searching our database.

Why Out of memory error when trying to create a thread?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Joachim - 06 Mar 2005 17:53 GMT
I'm using MS Visual C++ .NET, Windows XP, and 1GB RAM.
Why could be the reason why I get an error message saying

Out of memory

when running the following code

CClientThread* pThread = (CClientThread*)
AfxBeginThread(RUNTIME_CLASS(CClientThread), THREAD_PRIORITY_NORMAL, 0,
CREATE_SUSPENDED);

My application does only have this additional thread.
sergega4@yahoo.fr - 07 Mar 2005 01:05 GMT
Have you tried something simpler like

GetDlgItem(IDOK)->EnableWindow(FALSE);
AfxBeginThread(ComputeThreadProc, GetSafeHwnd(), THREAD_PRIORITY_HIGHEST);

where ComputeThreadProc is your global function executed by the thread ?
(like advised in the KrulingskyShepperdWingo's book)

good luck

Xav

> I'm using MS Visual C++ .NET, Windows XP, and 1GB RAM.
> Why could be the reason why I get an error message saying
[quoted text clipped - 8 lines]
>
> My application does only have this additional thread.
Joachim - 07 Mar 2005 20:59 GMT
Thanks Xav,

That's a worker thread, right?! I'm trying to create a multi-threaded server
which can serve several clients simultaneously, and I have heard that you
need user interface threads for this purpose.

Regards,
Joachim

> Have you tried something simpler like
>
[quoted text clipped - 20 lines]
> >
> > My application does only have this additional thread.
sergega4@yahoo.fr - 08 Mar 2005 12:07 GMT
a stupid suggestion, but I dare :
"Out of memory" makes me think of something not instanciated.
In your piece of code I see a CClientThread *Thread without any "new"
anywhere ?
Xav

> Thanks Xav,
>
> That's a worker thread, right?! I'm trying to create a multi-threaded server
> which can serve several clients simultaneously, and I have heard that you
> need user interface threads for this purpose.

> Regards,
> Joachim
[quoted text clipped - 23 lines]
> > >
> > > My application does only have this additional thread.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.