I get that: The process is terminated with all the records in database inserted, then when I see the task manager in Windows the sqlserver.exe process still have a 3.663.263mb occupying my in memory and is not released.......
You can control the server memory configuration and set
MAX SERVER MEMORY. here is a good overview document https://msdn.microsoft.com/en-us/library/ms178067.aspx
Minimum Maximum Memory Values are : 32bit - 64MB 64bit - 128mb
Set min server memory and max server memory to span a range of memory values. This method is useful for system or database administrators to configure an instance of SQL Server in conjunction with the memory requirements of other applications that run on the same computer.
Use min server memory to guarantee a minimum amount of memory available to the SQL Server Memory Manager for an instance of SQL Server. SQL Server will not immediately allocate the amount of memory specified in min server memory on startup. However, after memory usage has reached this value due to client load, SQL Server cannot free memory unless the value of min server memory is reduced.