MCPcopy Create free account
hub / github.com/GoEdgeLab/EdgeNode / TestNewList_Memory_String

Function TestNewList_Memory_String

internal/utils/linkedlist/list_test.go:38–55  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

36}
37
38func TestNewList_Memory_String(t *testing.T) {
39 var stat1 = &runtime.MemStats{}
40 runtime.ReadMemStats(stat1)
41
42 var list = linkedlist.NewList[string]()
43 for i := 0; i < 1_000_000; i++ {
44 var item = &linkedlist.Item[string]{}
45 item.Value = strconv.Itoa(i)
46 list.Push(item)
47 }
48
49 runtime.GC()
50
51 var stat2 = &runtime.MemStats{}
52 runtime.ReadMemStats(stat2)
53 t.Log((stat2.HeapInuse-stat1.HeapInuse)>>20, "MB")
54 t.Log(list.Len())
55}
56
57func TestList_Push(t *testing.T) {
58 var list = linkedlist.NewList[int]()

Callers

nothing calls this directly

Calls 4

LogMethod · 0.80
GCMethod · 0.65
PushMethod · 0.45
LenMethod · 0.45

Tested by

no test coverage detected