Fixed remaining memory leaks.
This commit is contained in:
21
Performance1.psess
Normal file
21
Performance1.psess
Normal file
@@ -0,0 +1,21 @@
|
||||
<VSPerformanceSession Version="1.00">
|
||||
<Options>
|
||||
<CollectionMethod>Sampling</CollectionMethod>
|
||||
<AllocationMethod>None</AllocationMethod>
|
||||
<AddReport>true</AddReport>
|
||||
<UniqueReport>Timestamp</UniqueReport>
|
||||
<SamplingMethod>Cycles</SamplingMethod>
|
||||
<CycleCount>10000000</CycleCount>
|
||||
<PageFaultCount>10</PageFaultCount>
|
||||
<SysCallCount>10</SysCallCount>
|
||||
<SamplingCounter PlatformID="00000000" CounterID="0000000000000000" ReloadValue="000000000000000a" />
|
||||
<RelocateBinaries>false</RelocateBinaries>
|
||||
<HardwareCounters EnableHWCounters="false" />
|
||||
</Options>
|
||||
<PreinstrumentEvent>
|
||||
<InstrEventExclude>false</InstrEventExclude>
|
||||
</PreinstrumentEvent>
|
||||
<PostinstrumentEvent>
|
||||
<InstrEventExclude>false</InstrEventExclude>
|
||||
</PostinstrumentEvent>
|
||||
</VSPerformanceSession>
|
||||
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.3.12.0")]
|
||||
[assembly: AssemblyFileVersion("1.3.12.0")]
|
||||
[assembly: AssemblyVersion("1.3.13.0")]
|
||||
[assembly: AssemblyFileVersion("1.3.13.0")]
|
||||
|
||||
@@ -22,6 +22,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
|
||||
chocolateyUninstall.ps1.guid = chocolateyUninstall.ps1.guid
|
||||
chocolateyUninstall.ps1.template = chocolateyUninstall.ps1.template
|
||||
LICENSE.txt = LICENSE.txt
|
||||
Performance1.psess = Performance1.psess
|
||||
README.md = README.md
|
||||
timberwinr.nuspec.template = timberwinr.nuspec.template
|
||||
EndProjectSection
|
||||
@@ -99,4 +100,7 @@ Global
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(Performance) = preSolution
|
||||
HasPerformanceSessions = true
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
||||
@@ -150,6 +150,7 @@ namespace TimberWinR.Inputs
|
||||
}
|
||||
// Close the recordset
|
||||
rs.close();
|
||||
GC.Collect();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace TimberWinR.Inputs
|
||||
private Dictionary<string, long> _logFileSizes;
|
||||
|
||||
|
||||
public LogsListener(TimberWinR.Parser.Log arguments, CancellationToken cancelToken, int pollingIntervalInSeconds = 3)
|
||||
public LogsListener(TimberWinR.Parser.Log arguments, CancellationToken cancelToken)
|
||||
: base(cancelToken, "Win32-FileLog")
|
||||
{
|
||||
_logFileMaxRecords = new Dictionary<string, Int64>();
|
||||
@@ -42,7 +42,7 @@ namespace TimberWinR.Inputs
|
||||
|
||||
_receivedMessages = 0;
|
||||
_arguments = arguments;
|
||||
_pollingIntervalInSeconds = pollingIntervalInSeconds;
|
||||
_pollingIntervalInSeconds = arguments.Interval;
|
||||
|
||||
foreach (string srcFile in _arguments.Location.Split(','))
|
||||
{
|
||||
@@ -146,6 +146,7 @@ namespace TimberWinR.Inputs
|
||||
|
||||
_logFileSizes[logName] = fi.Length;
|
||||
}
|
||||
rsfiles.close();
|
||||
foreach (string fileName in _logFileMaxRecords.Keys.ToList())
|
||||
{
|
||||
var lastRecordNumber = _logFileMaxRecords[fileName];
|
||||
@@ -163,6 +164,7 @@ namespace TimberWinR.Inputs
|
||||
for (; !rs.atEnd(); rs.moveNext())
|
||||
{
|
||||
var record = rs.getRecord();
|
||||
|
||||
var json = new JObject();
|
||||
foreach (var field in _arguments.Fields)
|
||||
{
|
||||
@@ -187,11 +189,14 @@ namespace TimberWinR.Inputs
|
||||
|
||||
var lrn = (Int64)record.getValueEx("Index");
|
||||
_logFileMaxRecords[fileName] = lrn;
|
||||
GC.Collect();
|
||||
}
|
||||
|
||||
colMap.Clear();
|
||||
// Close the recordset
|
||||
rs.close();
|
||||
rs = null;
|
||||
GC.Collect();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
||||
@@ -157,6 +157,7 @@ namespace TimberWinR.Inputs
|
||||
// Close the recordset
|
||||
rs.close();
|
||||
rs = null;
|
||||
GC.Collect();
|
||||
}
|
||||
}
|
||||
catch (System.Threading.ThreadAbortException tex)
|
||||
|
||||
@@ -133,6 +133,7 @@ namespace TimberWinR.Outputs
|
||||
else
|
||||
{
|
||||
_sentMessages++;
|
||||
GC.Collect();
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -142,6 +143,7 @@ namespace TimberWinR.Outputs
|
||||
Interlocked.Increment(ref _errorCount);
|
||||
}
|
||||
}
|
||||
GC.Collect();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -159,6 +161,7 @@ namespace TimberWinR.Outputs
|
||||
}
|
||||
}
|
||||
}
|
||||
GC.Collect();
|
||||
System.Threading.Thread.Sleep(_interval);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -198,6 +198,7 @@ namespace TimberWinR.Outputs
|
||||
}
|
||||
}
|
||||
client.EndPipe();
|
||||
GC.Collect();
|
||||
break;
|
||||
}
|
||||
else
|
||||
@@ -216,6 +217,7 @@ namespace TimberWinR.Outputs
|
||||
}
|
||||
}
|
||||
}
|
||||
GC.Collect();
|
||||
System.Threading.Thread.Sleep(_interval);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace TimberWinR.Outputs
|
||||
JObject[] messages;
|
||||
lock (_locker)
|
||||
{
|
||||
messages = _jsonQueue.Take(1).ToArray();
|
||||
messages = _jsonQueue.Take(_jsonQueue.Count).ToArray();
|
||||
_jsonQueue.RemoveRange(0, messages.Length);
|
||||
}
|
||||
|
||||
|
||||
@@ -262,6 +262,8 @@ namespace TimberWinR.Parser
|
||||
public bool SplitLongLines { get; set; }
|
||||
[JsonProperty(PropertyName = "fields")]
|
||||
public List<Field> Fields { get; set; }
|
||||
[JsonProperty(PropertyName = "interval")]
|
||||
public int Interval { get; set; }
|
||||
|
||||
public Log()
|
||||
{
|
||||
@@ -269,6 +271,7 @@ namespace TimberWinR.Parser
|
||||
Fields.Add(new Field("LogFilename", "string"));
|
||||
Fields.Add(new Field("Index", "integer"));
|
||||
Fields.Add(new Field("Text", "string"));
|
||||
Interval = 30;
|
||||
}
|
||||
|
||||
public void Validate()
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
$packageName = 'TimberWinR-${version}' # arbitrary name for the package, used in messages
|
||||
$installerType = 'msi' #only one of these: exe, msi, msu
|
||||
$url = 'http://www.ericfontana.com/TimberWinR/TimberWinR-${version}.0.msi' # download url
|
||||
$silentArgs = '{ABD20B9E-8628-40AD-AB11-5BD4356F9D94} /quiet'
|
||||
$silentArgs = '{B60FDD3E-615F-42C1-B587-6B46D262EF15} /quiet'
|
||||
$validExitCodes = @(0) #please insert other valid exit codes here, exit codes for ms http://msdn.microsoft.com/en-us/library/aa368542(VS.85).aspx
|
||||
UnInstall-ChocolateyPackage "$packageName" "$installerType" "$silentArgs" "$url" -validExitCodes $validExitCodes
|
||||
|
||||
|
||||
Reference in New Issue
Block a user