473,395 Members | 1,969 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

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

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.
Nov 17 '05 #1
3 3746
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
"Joachim" wrote:
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.

Nov 17 '05 #2
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

"se******@yahoo.fr" wrote:
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
"Joachim" wrote:
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.

Nov 17 '05 #3
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

"Joachim" wrote:
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

"se******@yahoo.fr" wrote:
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
"Joachim" wrote:
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.

Nov 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Andreas Suurkuusk | last post by:
Hi, I just noticed your post in the "C# memory problem: no end for our problem?" thread. In the post you implied that I do not how the garbage collector works and that I mislead people. Since...
0
by: Gavin Williams | last post by:
I am working on a multi-threaded server for a Windows 2000 system and since "fork" doesn't work that great in a Win32 environment, I am trying to use use the "threads" module instead. When a...
5
by: SPG | last post by:
Hi, We have a C# app that uis running as a service. It uses a third party activeX dll that we us to capture events. Because it is an activeX dll, we have to create our own message pump on a...
25
by: Zeng | last post by:
I finally narrowed down my code to this situation, quite a few (not all) of my CMyClass objects got hold up after each run of this function via the simple webpage that shows NumberEd editbox. My...
5
by: Tim Greenfield | last post by:
Hi, I have a problem I'm hoping is not too unusual. I'm trying to push a large file (50MB) out to the client from an ASP page. The reason I'm using an ASP page is so I can start the reading at a...
5
by: snicks | last post by:
I'm trying to exec a program external to my ASP.NET app using the following code. The external app is a VB.NET application. Dim sPPTOut As String sPPTOut = MDEPDirStr + sID + ".ppt" Dim p As...
6
by: Lee Leahu | last post by:
Hi List, I am trying to write a simple threaded application which will simulate 1000 connections to a remote service in order to "stress test" that the remote service can handle that many...
26
by: Bill Reid | last post by:
Bear with me, as I am not a "professional" programmer, but I was working on part of program that reads parts of four text files into a buffer which I re-allocate the size as I read each file. I...
5
by: Mahendra Kumar Kutare | last post by:
I am trying to implement a webserver with boss-worker model thread pool implementation - I have a header declaration threadpool.h as - typedef struct threadpool_work { void (*routine) ();...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.