lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Dear Lua enthusiasts,

I getting resource leak errors with Borland C++Builder 5 (Update Pack #1) when 
running lua.exe, or luac.exe in certain ways. I have built the programs with 
full debug support and CodeGuard enabled (from project options). Can somebody 
verify what I've got -- I was very surprised that this is so. I've contacted 
the Lua developers and they said that they know of *no* memory leaks in Lua, 
although they use tools such as Electric Fence and Rational Purify under UNIX.

Here's a concrete example of what I've got. For example, running lua.exe
as follows produces errors.

lua c:\lua\test\hello.lua

Here's a tiny part of lua.cgl (if you want to get to the lines mentioned
directly, run lua with the above arguments from the IDE):


Error 00001. 0x300010 (Thread 0x05D4):
Resource leak: The memory block (0xC2A774) was never freed

The memory block (0x00C2A774) [size: 16 bytes] was allocated with realloc
Call Tree:
   0x00407AC4(=lua.exe:0x01:006AC4) C:\lua\src\lmem.c#141
   0x00405814(=lua.exe:0x01:004814) C:\lua\src\lfunc.c#22
   0x0040BBF8(=lua.exe:0x01:00ABF8) C:\lua\src\lvm.c#89
   0x0040BC86(=lua.exe:0x01:00AC86) C:\lua\src\lvm.c#101
   0x0040DAB6(=lua.exe:0x01:00CAB6) C:\lua\src\lapi.c#231
   0x0040E584(=lua.exe:0x01:00D584) C:\lua\src\lib\lauxlib.c#104

------------------------------------------
Error 00002. 0x300010 (Thread 0x05D4):
Resource leak: The memory block (0xC2A740) was never freed

The memory block (0x00C2A740) [size: 16 bytes] was allocated with realloc
Call Tree:
   0x00407AC4(=lua.exe:0x01:006AC4) C:\lua\src\lmem.c#141
   0x00405814(=lua.exe:0x01:004814) C:\lua\src\lfunc.c#22
   0x0040BBF8(=lua.exe:0x01:00ABF8) C:\lua\src\lvm.c#89
   0x0040BC86(=lua.exe:0x01:00AC86) C:\lua\src\lvm.c#101
   0x0040DAB6(=lua.exe:0x01:00CAB6) C:\lua\src\lapi.c#231
   0x0040E584(=lua.exe:0x01:00D584) C:\lua\src\lib\lauxlib.c#104

------------------------------------------
Error 00003. 0x300010 (Thread 0x05D4):
Resource leak: The memory block (0xC2A754) was never freed

The memory block (0x00C2A754) [size: 26 bytes] was allocated with realloc
Call Tree:
   0x00407AC4(=lua.exe:0x01:006AC4) C:\lua\src\lmem.c#141
   0x0040A39B(=lua.exe:0x01:00939B) C:\lua\src\lstring.c#100
   0x0040A548(=lua.exe:0x01:009548) C:\lua\src\lstring.c#146
   0x0040DDF6(=lua.exe:0x01:00CDF6) C:\lua\src\lapi.c#317
   0x0040E598(=lua.exe:0x01:00D598) C:\lua\src\lib\lauxlib.c#104
   0x0040FBCD(=lua.exe:0x01:00EBCD) C:\lua\src\lib\lbaselib.c#646

------------------------------------------
Error 00004. 0x300010 (Thread 0x05D4):
Resource leak: The memory block (0xC2A7A8) was never freed

The memory block (0x00C2A7A8) [size: 16 bytes] was allocated with realloc
Call Tree:
   0x00407AC4(=lua.exe:0x01:006AC4) C:\lua\src\lmem.c#141
   0x00405814(=lua.exe:0x01:004814) C:\lua\src\lfunc.c#22
   0x0040BBF8(=lua.exe:0x01:00ABF8) C:\lua\src\lvm.c#89
   0x0040BC86(=lua.exe:0x01:00AC86) C:\lua\src\lvm.c#101
   0x0040DAB6(=lua.exe:0x01:00CAB6) C:\lua\src\lapi.c#231
   0x0040E584(=lua.exe:0x01:00D584) C:\lua\src\lib\lauxlib.c#104

------------------------------------------







about 250 such like follow...








------------------------------------------
Error 00248. 0x300010 (Thread 0x05D4):
Resource leak: The memory block (0xC2BAD0) was never freed

The memory block (0x00C2BAD0) [size: 32 bytes] was allocated with realloc
Call Tree:
   0x00407AC4(=lua.exe:0x01:006AC4) C:\lua\src\lmem.c#141
   0x00405814(=lua.exe:0x01:004814) C:\lua\src\lfunc.c#22
   0x0040BBF8(=lua.exe:0x01:00ABF8) C:\lua\src\lvm.c#89
   0x0040BC86(=lua.exe:0x01:00AC86) C:\lua\src\lvm.c#101
   0x0040DAB6(=lua.exe:0x01:00CAB6) C:\lua\src\lapi.c#231
   0x004113B5(=lua.exe:0x01:0103B5) C:\lua\src\lib\liolib.c#694

------------------------------------------
Functions called:
 delete (24 times)
 fwrite (1 times)
 fclose (1 times)
 fread (1 times)
 ungetc (1 times)
 fgetc (1 times)
 fopen (1 times)
 strchr (1 times)
 strcmp (24 times)
 memcmp (21 times)
 strlen (134 times)
 realloc (267 times)
 memcpy (129 times)
 delete[] (2 times)
 free (30 times)
 new[] (14 times)
 new (29 times)
 calloc (5 times)
 malloc (11 times)
Resource types used:
 file stream (1 allocs, 1 max)
 file handle (1 allocs, 1 max)
 object array (14 allocs, 13 max)
 object (29 allocs, 17 max)
 memory block (278 allocs, 259 max)
Modules used:
 00400000 06/05/2001 21:19:22 C:\lua\src\lua\lua.exe
 0CD00000 01/31/2000 05:00:00 C:\PROGRA~1\Borland\CBUILD~1\Bin\CG32.DLL
 20420000 05/08/2000 05:20:00 C:\WINNT\TRAYHOOK.dll
 32500000 08/07/2000 05:01:00 C:\PROGRA~1\Borland\CBUILD~1\Bin\CC3250.DLL
 69800000 07/21/2000 12:05:02 C:\WINNT\system32\SHELL32.dll
 6E420000 12/07/1999 14:00:00 C:\WINNT\System32\INDICDLL.dll
 75E60000 12/07/1999 14:00:00 C:\WINNT\System32\IMM32.dll
 77B50000 07/21/2000 12:05:02 C:\WINNT\system32\COMCTL32.DLL
 77C70000 07/21/2000 12:05:02 C:\WINNT\system32\SHLWAPI.DLL
 77D40000 07/21/2000 12:05:02 C:\WINNT\system32\RPCRT4.DLL
 77DB0000 07/21/2000 12:05:02 C:\WINNT\system32\ADVAPI32.DLL
 77E10000 07/21/2000 12:05:02 C:\WINNT\system32\USER32.DLL
 77E80000 07/21/2000 12:05:02 C:\WINNT\system32\KERNEL32.DLL
 77F40000 07/21/2000 12:05:02 C:\WINNT\system32\GDI32.DLL
 77F80000 07/21/2000 12:05:02 C:\WINNT\System32\ntdll.dll
==========================================

For your information I am running Windows 2000 SP1, BCB 5 Update Pack #1.

There are similar errors for the Lua compiler, luac. Just try to compile a 
script and you'll see.

I'm looking forward to any comments/help as I do need to use Lua in
a *reliable* product.

Thank you in advance for you consideration.

Yours sincerely,
Vesselin I. Peev