h
i make heavy use of CString in database and communications routines in a large program that runs for months. will this eventually cause HEAP problems?
thank
a

Re: CString mess HEAP in long running programs ? by Ivan

Ivan
Mon Mar 01 11:58:12 CST 2004

What kind of HEAP problem are you thinking about ?
For HEAP corruptions, the class CString alone used correctly will cause
problems.
For HEAP fragmentation, generic C++ code that uses a lot of allocations
in order to implement the deep-copy semantics of certain C++ objects
may cause heap fragmentation, but that is really up to your application,
and it cannot be foretold in advance.

--
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of any included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm


"Al Havrilla" <anonymous@discussions.microsoft.com> wrote in message
news:AED28DA7-8081-4294-8817-759A2CC6EE36@microsoft.com...
> hi
> i make heavy use of CString in database and communications routines in a
large program that runs for months. will this eventually cause HEAP
problems?
> thanks
> al
>



Re: CString mess HEAP in long running programs ? by Hendrik

Hendrik
Mon Mar 01 13:29:14 CST 2004

Ivan Brugiolo [MSFT] <ivanbrug@online.microsoft.com> wrote:
> What kind of HEAP problem are you thinking about ?
> For HEAP corruptions, the class CString alone used correctly will cause
> problems.

Er, "no problems"?

> [...]

Schobi

--
SpamTrap@gmx.de is never read
I'm Schobi at suespammers dot org

"Sometimes compilers are so much more reasonable than people."
Scott Meyers



Re: CString mess HEAP in long running programs ? by Ivan

Ivan
Mon Mar 01 14:11:16 CST 2004

Most definitely.
There are no known prolbem in any of the string library classes.
This must have been a typo.
I apologize.

--
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of any included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm


"Hendrik Schober" <SpamTrap@gmx.de> wrote in message
news:eH15HP8$DHA.3056@TK2MSFTNGP11.phx.gbl...
> Ivan Brugiolo [MSFT] <ivanbrug@online.microsoft.com> wrote:
> > What kind of HEAP problem are you thinking about ?
> > For HEAP corruptions, the class CString alone used correctly will cause
> > problems.
>
> Er, "no problems"?
>
> > [...]
>
> Schobi
>
> --
> SpamTrap@gmx.de is never read
> I'm Schobi at suespammers dot org
>
> "Sometimes compilers are so much more reasonable than people."
> Scott Meyers
>
>



Re: CString mess HEAP in long running programs ? by anonymous

anonymous
Mon Mar 01 17:36:09 CST 2004

thanks for the response.

yes, i'm aware of the heap fragmentation caused by the generic C++ program. seems heavy use of CString would excerabate this problem. i wasn't thinking that CString had bugs.

what, if anything, can be done to "help" the heap. i already do the normal things like not leaving "newed" objects in memory any longer than necessary, etc.

should the heapmin() function be run occassionally

thank
A


Re: CString mess HEAP in long running programs ? by Ivan

Ivan
Mon Mar 01 18:18:06 CST 2004

Most of the design strategies of the heap are biased towards
fast allocation / deallocation code paths for processes
that have a working-set proportional to the load.
This is particulalry effective in the services space,
where you would want to maintain scalability when the number of clients
grows.
This is one of the main motivation behind the LookAside lists,
that are good on average for 'hot' heaps, and bad from the fragmentation
point of view.
You should consider using Low Fragmentation Heap,
is you have a largely monothreated applicaiton with a very large excursion
in working set.
The only functions that cause a real "compactation" of the heap are
destructive
towards the LookAsides lists, or the LowFrag heap.
HeapWalk is one function that can be used to "force compaction",
but it will flush the LookAsides. HeapValidate completely removes the
LookAsides.
If your application needs to get to a minimal working set,
then you may consider creating and destroying the heap used by your
structures
across different runs of the same algorithm.

--
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of any included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm


"Al Havrilla" <anonymous@discussions.microsoft.com> wrote in message
news:DB6F485B-718D-45FC-9C87-06C3E02C8C6F@microsoft.com...
> thanks for the response.
>
> yes, i'm aware of the heap fragmentation caused by the generic C++
program. seems heavy use of CString would excerabate this problem. i
wasn't thinking that CString had bugs.
>
> what, if anything, can be done to "help" the heap. i already do the
normal things like not leaving "newed" objects in memory any longer than
necessary, etc.
>
> should the heapmin() function be run occassionally?
>
> thanks
> Al
>



Re: CString mess HEAP in long running programs ? by anonymous

anonymous
Mon Mar 01 18:26:08 CST 2004

thanks much for the hel

A


Re: CString mess HEAP in long running programs ? by Alexander

Alexander
Mon Mar 01 22:50:57 CST 2004

For the latest incarnation of CString in VC7, you can have your own
allocator.

"Al Havrilla" <anonymous@discussions.microsoft.com> wrote in message
news:DB6F485B-718D-45FC-9C87-06C3E02C8C6F@microsoft.com...
> thanks for the response.
>
> yes, i'm aware of the heap fragmentation caused by the generic C++
program. seems heavy use of CString would excerabate this problem. i
wasn't thinking that CString had bugs.
>
> what, if anything, can be done to "help" the heap. i already do the
normal things like not leaving "newed" objects in memory any longer than
necessary, etc.
>
> should the heapmin() function be run occassionally?
>
> thanks
> Al
>