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

Memory leak #178

Closed
xerenahmed opened this issue Dec 23, 2020 · 0 comments
Closed

Memory leak #178

xerenahmed opened this issue Dec 23, 2020 · 0 comments

Comments

@xerenahmed
Copy link

There is an excessive memory usage problem

image

Codes

        var buf bytes.Buffer
	table := tablewriter.NewWriter(&buf)
	table.SetHeader([]string{"Head", "Head", "Head", "Head", "Head", "Head"})

	var maxDataCount uint16
	for _, tr := range tl.Times {
		length := uint16(len(tr))
		if length > maxDataCount {
			maxDataCount = length
		}
	}

	for i := uint16(0); i <= maxDataCount-1; i++ {
		var row []string
		for j := 0; j < len(tl.Times); j++ {
			tr := tl.Times[j]
			data := "-"
			if len(tr)-1 >= int(i) && tr[int(i)] != "" {
				data = tr[int(i)]
			}
			row = append(row, data)
		}

		table.Append(row)
	}

	table.Render()
	tl.TimesMarkdown = buf.String()
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

1 participant