Note that there are some explanatory texts on larger screens.

plurals
  1. POSQL CLR - safe/unsafeand memory usage concerns
    text
    copied!<p>I'm running a MS SQL Server 2008 R2 installation which is in the process of being commissioned.</p> <p>I've written an application which encrypts and decrypts columns in tables on demand which works fine. This application uses a DataTable object in order to process through the rows in any given table.</p> <p>In order to integrate this into SQL, I'm forced to firstly create the following assembly to satisfy the usage of the DataTable object:</p> <pre><code>create assembly [system.data.datasetextensions] from 'C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5\System.Data.DataSetExtensions.dll' with permission_set = unsafe </code></pre> <p>No problem; of course I have to declare this as being unsafe as it contains a static field not marked read only, therefore not thread safe, therefore unpredictable from execution to execution.</p> <p>However, I would like to declare my main CLR DLL as being safe (obviously by signing, putting in the GAC etc) and can do this no probs. However, when I run the code, I get a nasty 'index out of range' error, which does not raise its ugly head if I declare my main CLR DLL as being unsafe also. I assume this is due to the fact that I am attempting to access an unsafe assembly, which is a no no for safe assemblies???</p> <p>A second thing is if this main CLR DLL is running as unsafe, are 'expired' CLR calls to this not cleaned up by SQL Server/.Net??? The memory consumption increases when I run it, but memory never seems to be released; I really don't want to wait until the App Domain is unloaded in order for memory to be freed!!</p> <p>Thanks you guys..</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload