Re: CPtrArray/Heap failed...

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



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
****

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




Joseph M. Newcomer [MVP]
email: newcomer@xxxxxxxxxxxx
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
.



Relevant Pages

  • Re: 32-bit programs on Windows x64
    ... KERNEL address space which can be in the paged pool (which is not the same as the pageable ... conceivably care about) and the amount which can be in the non-paged pool (the limit ... pageable memory is all that matters in terms of user performance, ... if there is 8.0 GB of RAM on the system? ...
    (microsoft.public.vc.mfc)
  • Re: running Linux with no swap space (but lots of RAM)
    ... Some amount of caching is necessary to achieve such I/O scheduling. ... The amount of memory allocated to ... Someone who thinks writing to /dev/null would result in lots of data being ... TB of RAM and fits in an ATX case using no more than 550 watts of power. ...
    (comp.os.linux.development.system)
  • Re: System Properties question: RAM
    ... I followed your instructions and the amount of physical memory available ... How do I see the BIOS and the RAM ... there's pretty much no point in installing more than 3. ...
    (microsoft.public.windowsxp.general)
  • Re: Does Vista Home Premimum Play Nice With 4GB Memory?
    ... 32-bit Vista does not know how to manage 4 GB memory, which is odd, ... aware having 4 GB RAM is OVERKILL for 99% of users. ... Changing from 1 GB to 2 GB there was some improvement, not a huge amount ... Going from 2 GB to 4GB using a 32 bit version of Vista ...
    (microsoft.public.windows.vista.general)
  • Re: CPtrArray/Heap failed...
    ... I have 4gb of Ram and windows 2003 server. ... My applicaiton is getting crash when it reached 2gb virtual memory size ... it is called a "database". ... I am creating strings on heap and storing address in CPtrArray object. ...
    (microsoft.public.vc.mfc)