We're trying to test our application running under CE 5.0. It was previously
working under CE 4.1, and we don't do anything fancy, so generally its been
working fine in CE 5.0.

I've hit a snag, and I don't understand why this one case would be odd in
any way.

In a windows message handler, we create an array of data with:

TCHAR *lParam = new TCHAR[_tcslen(parList->p.strParam) + 1];

We pass that memory to another message handler with:

PostMessage( ownerWin, cmd, wParam,(LPARAM) lParam );

and then leave. When we get to the other message handler, the value of
lParam is the same, (it is in the same process), and the data in the array is
all fine.

But, when we go to release the memory with:

delete [] lParam;

On CE 5.0, it aborts. CE 4.1 works fine.

Any ideas ? The assembly just takes the pointer and passes it to the library
call for delete.

Re: memory exception on array by Michael

Michael
Thu Jul 20 18:35:16 CDT 2006

Well, how many bytes (or TCHARs) does the message handler write to the
array? My bet is that it writes more than was allocated.

--
Michael Salamone [eMVP]
Entrek Software, Inc.
www.entrek.com


"anonymous" <anonymous@discussions.microsoft.com> wrote in message
news:90875BE9-473E-46C4-A0E2-CC2757D09827@microsoft.com...
> We're trying to test our application running under CE 5.0. It was
> previously
> working under CE 4.1, and we don't do anything fancy, so generally its
> been
> working fine in CE 5.0.
>
> I've hit a snag, and I don't understand why this one case would be odd in
> any way.
>
> In a windows message handler, we create an array of data with:
>
> TCHAR *lParam = new TCHAR[_tcslen(parList->p.strParam) + 1];
>
> We pass that memory to another message handler with:
>
> PostMessage( ownerWin, cmd, wParam,(LPARAM) lParam );
>
> and then leave. When we get to the other message handler, the value of
> lParam is the same, (it is in the same process), and the data in the array
> is
> all fine.
>
> But, when we go to release the memory with:
>
> delete [] lParam;
>
> On CE 5.0, it aborts. CE 4.1 works fine.
>
> Any ideas ? The assembly just takes the pointer and passes it to the
> library
> call for delete.
>
>