[Vm-dev] Memory leak in Windows clipboard handling

Henrik Johansen henrik.s.johansen at veloxit.no
Fri Nov 19 10:08:44 UTC 2010


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


More information about the Vm-dev mailing list