[Vm-dev] Memory leak in Windows clipboard handling

Eliot Miranda eliot.miranda at gmail.com
Fri Nov 19 19:53:09 UTC 2010


Henrik,

    great catch!  How did you find it??

On Fri, Nov 19, 2010 at 2:08 AM, Henrik Johansen <
henrik.s.johansen at veloxit.no> wrote:

>
> In sqWin32Window.c, function clipboardWriteFromAt
>
> The line
>
>  /* allocate temporary storage and copy string (inserting Lfs) */
>  cvt = tmp = malloc(utf8Count+1);
>
> cvt is not released before function returns.
>
> Should be safe to do so after its use in
>
> /* Convert data to Unicode UTF16. */
>  MultiByteToWideChar( CP_UTF8, 0, cvt, -1, out, wcharsNeeded );
>
>
> To reproduce:
> Write a large string in a workspace (say, 1MB of ascii chars), then
> repeatedly copy it.
> Squeak.exe's memory usage will grow, not released when doing garbage
> collection.
>
> Cheers,
> Henry
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20101119/5f7022ef/attachment.htm


More information about the Vm-dev mailing list