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

Fix NEO callstates #3599

Merged
merged 21 commits into from
Dec 19, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Neo/ProtocolSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@
/// <returns>The loaded <see cref="ProtocolSettings"/>.</returns>
public static ProtocolSettings Load(Stream stream)
{
var config = new ConfigurationBuilder().AddJsonStream(stream).Build();
using var config = new ConfigurationBuilder().AddJsonStream(stream).Build();

Check failure on line 134 in src/Neo/ProtocolSettings.cs

View workflow job for this annotation

GitHub Actions / Test-Everything

'IConfigurationRoot': type used in a using statement must be implicitly convertible to 'System.IDisposable'.

Check failure on line 134 in src/Neo/ProtocolSettings.cs

View workflow job for this annotation

GitHub Actions / Test-Everything

'IConfigurationRoot': type used in a using statement must be implicitly convertible to 'System.IDisposable'.

Check failure on line 134 in src/Neo/ProtocolSettings.cs

View workflow job for this annotation

GitHub Actions / Test-Everything

'IConfigurationRoot': type used in a using statement must be implicitly convertible to 'System.IDisposable'.

Check failure on line 134 in src/Neo/ProtocolSettings.cs

View workflow job for this annotation

GitHub Actions / Test-Everything

'IConfigurationRoot': type used in a using statement must be implicitly convertible to 'System.IDisposable'.

Check failure on line 134 in src/Neo/ProtocolSettings.cs

View workflow job for this annotation

GitHub Actions / Test (macos-latest)

'IConfigurationRoot': type used in a using statement must be implicitly convertible to 'System.IDisposable'.

Check failure on line 134 in src/Neo/ProtocolSettings.cs

View workflow job for this annotation

GitHub Actions / Test (macos-latest)

'IConfigurationRoot': type used in a using statement must be implicitly convertible to 'System.IDisposable'.

Check failure on line 134 in src/Neo/ProtocolSettings.cs

View workflow job for this annotation

GitHub Actions / Test (macos-latest)

'IConfigurationRoot': type used in a using statement must be implicitly convertible to 'System.IDisposable'.

Check failure on line 134 in src/Neo/ProtocolSettings.cs

View workflow job for this annotation

GitHub Actions / Test (macos-latest)

'IConfigurationRoot': type used in a using statement must be implicitly convertible to 'System.IDisposable'.
Copy link
Member

@cschuchardt88 cschuchardt88 Nov 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ConfigurationBuilder on build uses ConfigurationRoot may have to cast to it. either way needs to be fixed for memory leak.

or could do
((IDisposable)config).Dispose(); at of the method

https://github.com/dotnet/runtime/blob/9d5a6a9aa463d6d10b0b0ba6d5982cc82f363dc3/src/libraries/Microsoft.Extensions.Configuration/src/ConfigurationBuilder.cs#L53C24-L53C41

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was not a memory leak...

Copy link
Member

@cschuchardt88 cschuchardt88 Nov 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ConfiguationRoot is the class that is created for inherits from IConfigurationRoot

How isn't it a memory leak, The memory for the providers are still allocated? Streams and all.
https://github.com/dotnet/runtime/blob/9d5a6a9aa463d6d10b0b0ba6d5982cc82f363dc3/src/libraries/Microsoft.Extensions.Configuration/src/ConfigurationRoot.cs#L99C9-L112C10

Just do (config as IDisposable)?.Dispose() what's the big deal?

var section = config.GetSection("ProtocolConfiguration");
var settings = Load(section);
CheckingHardfork(settings);
Expand Down
Loading