Skip to content

Commit

Permalink
解决内存溢出问题
Browse files Browse the repository at this point in the history
  • Loading branch information
lumiaoshan committed Oct 27, 2023
1 parent 810302c commit 12c1234
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 6 deletions.
2 changes: 1 addition & 1 deletion AirdPro/AirdPro.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@
<WCFMetadata Include="Connected Services\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="AirdSDK" Version="2.4.1.1" />
<PackageReference Include="AirdSDK" Version="2.4.1.3" />
<PackageReference Include="MathNet.Numerics">
<Version>5.0.0</Version>
</PackageReference>
Expand Down
24 changes: 20 additions & 4 deletions AirdPro/Algorithms/Compressor/CoreComp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -279,11 +279,27 @@ public override void compress(Spectrum spectrum, TempScan ts)
Array.Copy(mzArray, mzSubArray, j);
int[] intensitySubArray = new int[j];
Array.Copy(intensityArray, intensitySubArray, j);
byte[] compressedMzArray = null;
byte[] compressedIntArray = null;

if (mzSubArray.Length == 0)
{
compressedMzArray = new byte[0];
}
else
{
compressedMzArray = ComboComp.encode(mzIntComp, mzByteComp, mzSubArray);
}


byte[] compressedMzArray = ComboComp.encode(mzIntComp, mzByteComp, mzSubArray);
byte[] compressedIntArray = ComboComp.encode(intIntComp, intByteComp, intensitySubArray);

if (intensitySubArray.Length == 0)
{
compressedIntArray = new byte[0];
}
else
{
compressedIntArray = ComboComp.encode(intIntComp, intByteComp, intensitySubArray);
}

ts.mzArrayBytes = compressedMzArray;
ts.intArrayBytes = compressedIntArray;
}
Expand Down
7 changes: 6 additions & 1 deletion AirdPro/Converters/Converter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ public void addToIndex(BlockIndex index, object tempScan)
index.msTypes.AddRange(ts.msTypes);
index.cvList.AddRange(ts.cvs);

if (ts.mzArrayBytes.Length != 0 && ts.intArrayBytes.Length != 0 && ts.tagArrayBytes.Length != 0)
if (ts.mzArrayBytes.Length != 0 && ts.intArrayBytes.Length != 0 && ts.tagArrayBytes.Length != 0)
{
index.mzs.Add(ts.mzArrayBytes.Length);
index.ints.Add(ts.intArrayBytes.Length);
Expand Down Expand Up @@ -696,6 +696,11 @@ public void clearCache()
mobiDict = new();
mobiInfo = new();
chromatogramIndex = new();
if (msd != null)
{
msd.Dispose();
msd = null;
}
}

//DDA模式下,key为ms2Index.pNum, DIA模式下,key为ms2Index.precursorMz
Expand Down

0 comments on commit 12c1234

Please sign in to comment.