Hey @iamacarpet.
I'm trying to use a part of a package to control windows firewall.
It works well, but it doesn't release memory. For example, running functions in a loop will cause continuous incremental memory usage.
Looking at the library, it seems that this topic is taken care of(functions like firewallAPIRelease, firewallRulesEnumRealease).
Here's an example of code that replicates an issue.
package main
import (
"fmt"
winapi "github.com/kumako/go-win64api"
"time"
)
func main(){
var first string
for 1>0 {
fmt.Scanln(&first)
if first == "run"{
firewallTest()
}
}
}
func firewallTest(){
//get the list of the rules
ruleList, _ := winapi.FirewallRulesGet()
//delete them one by one using their names
for _, eachRule := range ruleList {
ruleName := eachRule.Name
if ruleName != ""{
winapi.FirewallRuleDelete(ruleName)
}
}
//wait for 30 second
time.Sleep(30 * time.Second)
//add them back, one by one, from the list
for _, eachRule := range ruleList{
winapi.FirewallRuleAddAdvanced(eachRule)
}
}
Hey @iamacarpet.
I'm trying to use a part of a package to control windows firewall.
It works well, but it doesn't release memory. For example, running functions in a loop will cause continuous incremental memory usage.
Looking at the library, it seems that this topic is taken care of(functions like firewallAPIRelease, firewallRulesEnumRealease).
Here's an example of code that replicates an issue.