Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

May be a memory leak in PbfReader ? #138

Closed
WernerMairl opened this issue Mar 5, 2022 · 1 comment
Closed

May be a memory leak in PbfReader ? #138

WernerMairl opened this issue Mar 5, 2022 · 1 comment

Comments

@WernerMairl
Copy link

Hi

May be there is a memory issue inside the PbfReader!

var ms = new MemoryStream(blob.zlib_data);
sourceStream = new ZLibStreamWrapper(ms);
}
// use the stream to read the block.
using (sourceStream)
{
if (header.type == Encoder.OSMHeader)
{
_runtimeTypeModel.Deserialize(sourceStream, null, _headerBlockType);
notFoundBut = true;
}
if (header.type == Encoder.OSMData)
{
block = _runtimeTypeModel.Deserialize(sourceStream, _block, _primitiveBlockType) as PrimitiveBlock;
}
}
}
return block;

The MemoryStream in Line 114 seems never be disposed, because the ZLibStreamWrapper seems to not close/dispose the wrapped stream!

OK, may be the GC solves this problem later in time, but (Memory) streams should be disposed asap...

i hope this helps...

br
Werner

@xivk
Copy link
Contributor

xivk commented Mar 5, 2022

@xivk xivk closed this as completed Nov 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants