http://bugs.winehq.org/show_bug.cgi?id=26231
Summary: File IO memory consumption Product: Wine Version: unspecified Platform: x86 OS/Version: Linux Status: UNCONFIRMED Severity: major Priority: P2 Component: ntdll AssignedTo: wine-bugs@winehq.org ReportedBy: manjak4s@ukr.net
Tested on: Ubuntu ( Linux version 2.6.31-20-generic. VMWare vm ) CentOS ( Linux version 2.6.18-164.15.1.el5. VMWare vm ) Gentoo ( Linux version 2.6.34-gentoo-r6. VMWare vm, physical machine ) File Systems: ext2, ext3. Reprodused: always.
Function: WriteFile(any params). Haven't tested ReadFile yet.
WriteFile causes FS buffer grows equal to amount of data written (after writing threshold amount of data, kernel kills process with "out of memory" message). Memory freed only after buffer become invalid (for example, echo > <filename>. FS keeps memory even after wine process and wine server finished execution).
Simple program:
BYTE pBuffer[1024]; DWORD dwWritten = 0;
memset(pBuffer, 0xCE, sizeof(pBuffer));
HANDLE hFile = CreateFile(_T("C:\test.img"), GENERIC_ALL, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
for (int i = 0; i < 256 * 1024; ++i) { WriteFile(hFile, pBuffer, sizeof(pBuffer), &dwWritten, NULL); }
CloseHandle(hFile);
Output: 256Mb memory leak.
Temporary I have added O_DIRECT option support to wine server and switched to ext2 FS(works fine for me).