Re: CPtrArray/Heap failed...
- From: Joseph M. Newcomer <newcomer@xxxxxxxxxxxx>
- Date: Tue, 10 Mar 2009 17:37:44 -0500
See below...
On Tue, 10 Mar 2009 18:04:22 +0530, "jjoohhnn" <jjoohhnn@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
Giovanni,****
I noticed one more thing.
I have 4gb of Ram and windows 2003 server.
Irrelevant. See my previous post. The amount of user space you have available is *not* a
function of the amount of installed RAM. You can put 64GB of RAM on your machine and
NOTHING WILL CHANGE because the amount of physical RAM in no way affects the amount of
space you have available in a process.
*****
****
My applicaiton is getting crash when it reached 2gb virtual memory size
and 2gb memory usage from the task manager.
Sounds exactly as expected. You only have 2GB of user address space, so in fact this is
doing exactly what it is supposed to.
****
****
Is it cause to get crash my applicaiton for 400,000 entries.
You have used the word "crash" without actually indicating what you are seeing. Note that
it is your responsibility to check every allocation to make sure it has succeeded, and in
some cases to make sure you have a proper exception handler for the allocation failure.
You have not demonstrated that you have done this
****
****
Any clue?
Yes. You are trying to use more address space than you have. You explicitly said this!
No surprise.
We have a solution for the case where you need more data available than will fit into
memory; it is called a "file". We have solutions for string-to-string mappings for
massive collections of strings; it is called a "database". These technologies were
developed in the 1950s to deal with the problem that we have more data than memory. To
handle performance issues, we have concepts like "query optimization", "caching", etc.
20 years ago we needed the equivalent of a STRINGTABLE in MS-DOS; we had a huge number of
error messages/prompts and they could not be literals in the source code because that took
too much space in the available 640K we could use, and we were selling internationally and
needed to localize the messages.
It took me several hours to write a cache that kept the most-recently-used messages in
memory and to build an index of message numbers to file positions; the cache was a
two-tiered cache for "short messages" (< 20 characters) and "long messages" (> 20
characters). I think I spent 4 hours writing this code and debugging it. Thus we could
fit about 128K of messages into a program that didn't have 128K of available space. So
whether you go for a database solution or hand-roll a solution, you have several issues to
answer about space and lookup time. It is obvious your current solution cannot work
because it requires more space than you have available.
joe
****
Joseph M. Newcomer [MVP]
Thanks in advance.
Regards,
jjoohhnn.
"Giovanni Dicanio" <giovanniDOTdicanio@xxxxxxxxxxxxxxxxx> wrote in message
news:%23I0$0yWoJHA.1292@xxxxxxxxxxxxxxxxxxxxxxx
"jjoohhnn" <jjoohhnn@xxxxxxxxxxxxxxxxxxxxxxxxx> ha scritto nel messaggio
news:urLelxUoJHA.6060@xxxxxxxxxxxxxxxxxxxxxxx
I have CPtrArray and CMapStringToString objects in my application.
I am creating strings on heap and storing address in CPtrArray object.
Another point that is not clear to me is: why do you use CPtrArray and not
just CStringArray to store the array of strings?
Do you create instances of CString on the heap using 'new CString'??
This seems weird to me.
You may want to post some actual code...
Giovanni
email: newcomer@xxxxxxxxxxxx
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
.
- Follow-Ups:
- Re: CPtrArray/Heap failed...
- From: jjoohhnn
- Re: CPtrArray/Heap failed...
- References:
- CPtrArray/Heap failed...
- From: jjoohhnn
- Re: CPtrArray/Heap failed...
- From: Joseph M . Newcomer
- Re: CPtrArray/Heap failed...
- From: Giovanni Dicanio
- Re: CPtrArray/Heap failed...
- From: jjoohhnn
- Re: CPtrArray/Heap failed...
- From: Giovanni Dicanio
- Re: CPtrArray/Heap failed...
- From: jjoohhnn
- CPtrArray/Heap failed...
- Prev by Date: Re: CPtrArray/Heap failed...
- Next by Date: Re: Moving to VisualStudio 2008
- Previous by thread: Re: CPtrArray/Heap failed...
- Next by thread: Re: CPtrArray/Heap failed...
- Index(es):
Relevant Pages
|