Tracking memory allocation

Jeff L lats at
Fri Oct 27 17:40:33 CDT 2006

Robert Shearman wrote:

> Jeff L wrote:
>> Robert Shearman wrote:
> Yes, it does. You can look at dlls/ntdll/tests/rtl.c to see how the 
> functions can be used.

Yep can see how that works now.

>> If I run out of handles, how do I reallocate the table or add to it?
> You can't. It is intended to be a fixed size table.

In this case I assume that if I allocate a big table it would be ok to 
fail calls for more memory at some point due to the table being full.

>> Are the functions thread safe if I anchor the handletable off a 
>> static variable in the dll?  I am going to need a persistent table 
>> for the life of the dll.  Hence it has the potential to be used by 
>> multiple threads.
> No. You need to protect the accessing of the handle table and handles 
> with a critical section.

Another way looks like using TlsAlloc in dllmain to allocate TlsIndex to 
provide separate the storage anchors between threads and thus build in 
thread safe behaviour.  Looks like an additional overhead in dll load 
and  thread creation as opposed to the use of a lot of critical sections 
Is there any thought as to what the trade offs are in wine on the 2 


More information about the wine-devel mailing list