diff --git a/LibNoDaveConnectionLibrary/DataTypes/Projectfolders/Step7V5/BlocksOfflineFolder.cs b/LibNoDaveConnectionLibrary/DataTypes/Projectfolders/Step7V5/BlocksOfflineFolder.cs index 32894b78..00a72b92 100644 --- a/LibNoDaveConnectionLibrary/DataTypes/Projectfolders/Step7V5/BlocksOfflineFolder.cs +++ b/LibNoDaveConnectionLibrary/DataTypes/Projectfolders/Step7V5/BlocksOfflineFolder.cs @@ -65,6 +65,19 @@ public List BlockInfos get { return readPlcBlocksList(); } } + /// + /// Drops the converted blocks cached on this folder's block infos, so they can be garbage collected. + /// Call this when converting many blocks one after another, otherwise every converted block stays in memory. + /// + public void ClearBlockCache() + { + if (_intBlockList == null) + return; + + foreach (var blkInfo in _intBlockList) + blkInfo._Block = null; + } + /// /// Read all blocks from the S7 Project and cache them into the 'tmpBlocks' field. ///