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: typo #4

Merged
merged 1 commit into from
Jul 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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 cmd/constant.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ const (
intervalCpuWorkerCheckContextDone = 10000
durationMemoryWorkerDoRefresh = 5 * time.Minute
durationEachSignCheck = 100 * time.Millisecond
chunkSizeMemoryWokerEachAllocate = 128 * 1024 * 1024 // 128MB
chunkSizeMemoryWorkerEachAllocate = 128 * 1024 * 1024 // 128MB
)
6 changes: 3 additions & 3 deletions cmd/memory.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ func (m *ActiveMemoryManager) AllocateMemory(ctx context.Context) error {
if m.size > curFreeSize {
return fmt.Errorf("free memory not enough: %d > %d", m.size, curFreeSize)
}
// split request memory to multiple small-size chunks
const unitChunk = chunkSizeMemoryWokerEachAllocate
//split request memory to multiple small-size chunks
const unitChunk = chunkSizeMemoryWorkerEachAllocate
nChunks := m.size / unitChunk
remain := m.size % unitChunk
bufSizes := []uint64{}
Expand All @@ -51,7 +51,7 @@ func (m *ActiveMemoryManager) AllocateMemory(ctx context.Context) error {
m.buffers = make([][]byte, len(bufSizes))
for i := range m.buffers {
// This also has the added benefit of checking that context is canceled before each small memory allocation,
// which gives you a chance to gracefully shut down eat memory goroutine instead of brutally killing it
// which gives you a chance to gracefully shut down eat memory goroutine instead of brutally killing it
// if you want to `eat` dozens of gigabytes of memory and the OS has swap partition turned on .
select {
case <-ctx.Done():
Expand Down
Loading