There is an ASP.NET webservice that peforms a LoadLibrary() call to load an unmanaged .dll on each call to the webservice and then P/Invokes a number of functions in the unmanaged .dll.
Does the threading model used by ASP.NET to service multiple simultaneous requests mean that there can potentially be memory problems whereby the memory allocated inside the unmanaged code is stepped on by subsequent webservice requests?
Are different webservice requests allocated their own memory space within the unmanaged code or are they clashing over the same space?
Thanks!
Where the memory allocated for p/invoke calls depends on the particular call, but overall there shouldn’t be a problem as long as you clean up unmanaged resources properly, because the garbage collector wont. In that sense an ASP.NET application is just like any other multi-threaded application.