I agree that this works it would be a good solution, but how would I
set the size of this buffer? I can't find anything that would do that
in the CPString class, and documentation for that class is nowhere to be found.
I don't see how GlobalAlloc() would be accessing an internal buffer,
as it is a Windows function, but then I'm not an expert on 16 bit
Windows memory management.
By the way, GlobalAlloc() is only called when
othewise, malloc() would be called.
At 04:19 PM 22/12/2008, Philip Sheard wrote:
>You are probably getting this error because the CPString package is
>using a fixed internal buffer. The best workaround may be to
>increase the size of that buffer, and you should be able to do this
>without modifying the source code.
>From: bounce-752805-90808@news... >[mailto:bounce-752805-90808@news...] On Behalf Of
>chenier@alum... >Sent: 22 December 2008 20:23
>To: Conduit Developer Forum
>Subject: CPString, out of memory (GlobalAlloc)
>I use CPString throughout my conduit and it's always worked fine for
>me. Recently, I started getting an access violation when
>synchronizing a large file. The operation I get this on is when I
>call CPString::operator+ (I'm concatenating a CPString with a
>char). It calls CPString::ConcatCopy() which calls
>CPString::Resize() which calls CPString::Size() which calls
>GlobalAlloc() which returns NULL. All works fine for small files and
>at the beginning of large files, but as more memory is used by the
>conduit, the NULL eventually gets returned. When this happens, my
>PC's memory is far from full: if I call malloc() then, I can easily
>allocate 400MB or more.
>The strings I am trying to concatenate are quite short (15 + 4
>characters). If I call GetLastError(), I get 0x000000008, out of memory error.
>Why am I getting this? Any workaround?
>I'm tempted to make a copy of the CPString class and modify it to
>use malloc() and free(). I'm not using MFC as I hope to port this to
>a Mac one day.