February 28, 2004
In article <c1947u$i94$1@digitaldaemon.com>, Richard Haney says...
>
>My application crashes apparently while the following declaration code is trying to allocate memory on the heap:
>
>const string lt("&lt;");
>
..
>
>But the first sign of memory allocation problems is earlier in the program when the following statement has allocated the string "Comments on wild0" when it should have allocated the string "Comments on wilderness preservation":
>
>subj_p = new string(outbuf.begin(),out_scan);
>

I was able to get rid of the memory allocation problem by avoiding the use of the 'new' operator.  Evidently string objects will do their own dynamic allocation of whatever space they need.  I suppose the problem might have been due to a need to turn on the compiler option "allow overloading of new[], delete[] operators", but it did not seem clearly needed and I have not successfully tried toggling this switch to get rid of the problem.