Click here to Skip to main content
16,005,281 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Multi threading Pin
Cedric Moonen29-Nov-07 1:37
Cedric Moonen29-Nov-07 1:37 
GeneralRe: Multi threading Pin
Luc Pattyn29-Nov-07 1:44
sitebuilderLuc Pattyn29-Nov-07 1:44 
GeneralRe: Multi threading Pin
Jothi.G8129-Nov-07 1:48
Jothi.G8129-Nov-07 1:48 
GeneralRe: Multi threading Pin
Cedric Moonen29-Nov-07 1:56
Cedric Moonen29-Nov-07 1:56 
QuestionRe: Multi threading Pin
David Crow29-Nov-07 3:36
David Crow29-Nov-07 3:36 
GeneralRe: Multi threading Pin
led mike29-Nov-07 5:19
led mike29-Nov-07 5:19 
AnswerRe: Multi threading Pin
KarstenK29-Nov-07 2:24
mveKarstenK29-Nov-07 2:24 
AnswerRe: Multi threading Pin
Randor 29-Nov-07 4:20
professional Randor 29-Nov-07 4:20 
Hello,

The default stack size for each thread is 1MB, 32-bit Windows is capable of supporting up to 4 GB of system memory, with up to 2 GB of dedicated memory per process.

1986 * 1MB == 1986MB

The parent process is probably using the remaining memory. Which means you are at the limit of addressable memory per process.

You can possibly fix this.

http://msdn2.microsoft.com/en-us/library/ms682453.aspx[^]

Call CreateThread() to make your threads, pass STACK_SIZE_PARAM_IS_A_RESERVATION as dwCreationFlags and put 524288 as stacksize. This is (512 kilobytes)

Might look something like:

pMyThread = new MyThread();

if(NULL != pMyThread)
{
    if (!pMyThread->CreateThread(CREATE_SUSPENDED | STACK_SIZE_PARAM_IS_A_RESERVATION ,524288,NULL))
    {
        delete pMyThread;
        pMyThread=NULL;
    }
    else
    {
        pMyThread->ResumeThread();
        pMyThread->m_bAutoDelete = TRUE;
        ::PostThreadMessage(pMyThread->m_nThreadID,WM_THREAD_START,0,0);
    }
}


Creating your threads this way could double the amount of threads available to your process.

-Randor (David Delaune)
GeneralRe: Multi threading Pin
Roger Stoltz29-Nov-07 4:29
Roger Stoltz29-Nov-07 4:29 
QuestionCMyView post a message for CMyApp to process Pin
followait29-Nov-07 1:07
followait29-Nov-07 1:07 
AnswerRe: CMyView post a message for CMyApp to process Pin
Nelek29-Nov-07 1:37
protectorNelek29-Nov-07 1:37 
GeneralRe: CMyView post a message for CMyApp to process Pin
followait29-Nov-07 3:17
followait29-Nov-07 3:17 
Questionincluding vector header Pin
Schehaider_Aymen29-Nov-07 1:05
Schehaider_Aymen29-Nov-07 1:05 
QuestionRe: including vector header Pin
Maximilien29-Nov-07 1:12
Maximilien29-Nov-07 1:12 
AnswerRe: including vector header Pin
Schehaider_Aymen29-Nov-07 1:16
Schehaider_Aymen29-Nov-07 1:16 
GeneralRe: including vector header Pin
toxcct29-Nov-07 1:27
toxcct29-Nov-07 1:27 
GeneralRe: including vector header Pin
Schehaider_Aymen29-Nov-07 1:33
Schehaider_Aymen29-Nov-07 1:33 
GeneralRe: including vector header [modified] Pin
toxcct29-Nov-07 1:40
toxcct29-Nov-07 1:40 
GeneralRe: including vector header Pin
Nelek29-Nov-07 23:40
protectorNelek29-Nov-07 23:40 
GeneralRe: including vector header Pin
Jijo.Raj29-Nov-07 1:32
Jijo.Raj29-Nov-07 1:32 
GeneralRe: including vector header Pin
toxcct29-Nov-07 1:35
toxcct29-Nov-07 1:35 
GeneralRe: including vector header Pin
Schehaider_Aymen29-Nov-07 1:39
Schehaider_Aymen29-Nov-07 1:39 
GeneralRe: including vector header Pin
toxcct29-Nov-07 1:43
toxcct29-Nov-07 1:43 
GeneralRe: including vector header Pin
Schehaider_Aymen29-Nov-07 1:36
Schehaider_Aymen29-Nov-07 1:36 
GeneralRe: including vector header Pin
toxcct29-Nov-07 1:44
toxcct29-Nov-07 1:44 

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.