Click here to Skip to main content
15,918,742 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: GDI problem Pin
trioum30-Jul-07 23:01
trioum30-Jul-07 23:01 
GeneralRe: GDI problem Pin
Nelek2-Aug-07 20:09
protectorNelek2-Aug-07 20:09 
QuestionClip Region of CDC Pin
himuskanhere29-Jul-07 18:56
himuskanhere29-Jul-07 18:56 
AnswerRe: Clip Region of CDC Pin
csc29-Jul-07 20:14
csc29-Jul-07 20:14 
JokeRe: Clip Region of CDC Pin
himuskanhere29-Jul-07 20:55
himuskanhere29-Jul-07 20:55 
Questionrow = mysql_fetch_row(res); Pin
p_29-Jul-07 18:42
p_29-Jul-07 18:42 
AnswerRe: row = mysql_fetch_row(res); Pin
Shouvik Das29-Jul-07 23:48
Shouvik Das29-Jul-07 23:48 
QuestionHow to solve "Out of memory" Pin
Pogo Lin29-Jul-07 16:32
Pogo Lin29-Jul-07 16:32 
Hi all,
Recently, I have encountered a "Out of memory" issue, but I found that system still has enough memory.
Here are some information about this issue.
I tried to new an array like below codes
try<br />
{<br />
<br />
<br />
unsigned long* mImage = new unsigned long[67108864]; // 256MByte<br />
<br />
}<br />
catch( CMemoryException* pEX)<br />
{<br />
        CString cstmp;<br />
        CString csOut;<br />
        MEMORYSTATUS stat;        <br />
        GlobalMemoryStatus (&stat);<br />
       <br />
        cstmp.Format("The MemoryStatus structure is %ld bytes long.\n",stat.dwLength);<br />
        csOut+=cstmp;<br />
        cstmp.Format("It should be %d.\n", sizeof (stat));<br />
        csOut+=cstmp;<br />
        cstmp.Format("%ld percent of memory is in use.\n",stat.dwMemoryLoad);<br />
        csOut+=cstmp;<br />
        cstmp.Format("There are %7d total Kbytes of physical memory.\n",stat.dwTotalPhys/1024);<br />
        csOut+=cstmp;<br />
        cstmp.Format("There are %7d free Kbytes of physical memory.\n",stat.dwAvailPhys/1024);<br />
        csOut+=cstmp;<br />
        cstmp.Format("There are %7d total Kbytes of paging file.\n",stat.dwTotalPageFile/1024);<br />
        csOut+=cstmp;<br />
        cstmp.Format("There are %7d free Kbytes of paging file.\n",stat.dwAvailPageFile/1024);<br />
        csOut+=cstmp;<br />
        cstmp.Format("There are %7x total Kbytes of virtual memory.\n",stat.dwTotalVirtual/1024);<br />
        csOut+=cstmp;<br />
        cstmp.Format("There are %7x free Kbytes of virtual memory.\n",stat.dwAvailVirtual/1024);<br />
        csOut+=cstmp;<br />
        pEx->Delete();<br />
        AfxMessageBox(csOut);<br />
}


System will throw an exception( CMemoryException ) and I tried to print out the status of memory.
The following list is the output result.

The MemoryStatus structure is 32 bytes long.
It should be 32.
36 percent of memory is in use.
There are 2096100 total Kbytes of physical memory.
There are 1321288 free Kbytes of physical memory.
There are 4041780 total Kbytes of paging file.
There are 3615048 free Kbytes of paging file.
There are 1fff80 total Kbytes of virtual memory.
There are 70e94 free Kbytes of virtual memory.

I think that system still has about 1.3GB memory but I just want to allocate 256MB. Why does system throw a memory exception and tell me an error message "out of memory"?
Does any one can tell how I can solve this problem?? Any suggestions are welcome. Thanks a lot.



Regards,
Pogo Lin
AnswerRe: How to solve "Out of memory" Pin
Paul Conrad29-Jul-07 17:16
professionalPaul Conrad29-Jul-07 17:16 
GeneralRe: How to solve "Out of memory" Pin
Pogo Lin31-Jul-07 20:28
Pogo Lin31-Jul-07 20:28 
AnswerRe: How to solve "Out of memory" Pin
Stephen Hewitt29-Jul-07 19:12
Stephen Hewitt29-Jul-07 19:12 
QuestionHow to wirte a text editor from scratch? Pin
lichongbin29-Jul-07 14:03
lichongbin29-Jul-07 14:03 
AnswerRe: How to wirte a text editor from scratch? Pin
Nelek29-Jul-07 22:01
protectorNelek29-Jul-07 22:01 
QuestionMotion sensing Pin
mlibkind29-Jul-07 11:24
mlibkind29-Jul-07 11:24 
AnswerRe: Motion sensing Pin
eraccn29-Jul-07 15:00
eraccn29-Jul-07 15:00 
QuestionWriting My Own: Windows Desktop Shell Pin
convivial.developer29-Jul-07 10:40
convivial.developer29-Jul-07 10:40 
AnswerRe: Writing My Own: Windows Desktop Shell Pin
Stephen Hewitt29-Jul-07 15:03
Stephen Hewitt29-Jul-07 15:03 
GeneralRe: Writing My Own: Windows Desktop Shell Pin
convivial.developer29-Jul-07 16:21
convivial.developer29-Jul-07 16:21 
GeneralRe: Writing My Own: Windows Desktop Shell Pin
Stephen Hewitt29-Jul-07 16:24
Stephen Hewitt29-Jul-07 16:24 
GeneralRe: Writing My Own: Windows Desktop Shell Pin
convivial.developer30-Jul-07 2:26
convivial.developer30-Jul-07 2:26 
AnswerRe: Writing My Own: Windows Desktop Shell Pin
David Crow30-Jul-07 4:06
David Crow30-Jul-07 4:06 
QuestionHEAP issues with Overlapped I/O using completion port Pin
Zerox MXI29-Jul-07 6:07
Zerox MXI29-Jul-07 6:07 
QuestionRe: HEAP issues with Overlapped I/O using completion port Pin
Mark Salsbery30-Jul-07 6:39
Mark Salsbery30-Jul-07 6:39 
AnswerRe: HEAP issues with Overlapped I/O using completion port Pin
Zerox MXI30-Jul-07 15:46
Zerox MXI30-Jul-07 15:46 
Questionerrors while using class wizard Pin
l_d29-Jul-07 3:37
l_d29-Jul-07 3:37 

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.