gno icon indicating copy to clipboard operation
gno copied to clipboard

Add capability to check memory usage within the code

Open Kouteki opened this issue 1 year ago • 3 comments

          If it's possible to pull various data from the `Machine`, how about creating a package like `runtime`? I think it would be useful if we could directly check the memory usage by using `Alloc` field including gas usage, within the code.

https://github.com/gnolang/gno/blob/de2fc456c1cdf141def2a4ac77d5d0d5bf757a2d/gnovm/pkg/gnolang/alloc.go#L9-L12

Originally posted by @notJoon in https://github.com/gnolang/gno/issues/1998#issuecomment-2084697255

Kouteki avatar May 10 '24 08:05 Kouteki

Can I assume that you suggests a feature that realm developers are able to check the amount that will be allocated in memory of the data, and how much it does cost in gas ? If I was right I will implement this feat as I am currently doing the GasUsed() funtions ✋ @notJoon

thinhnx-var avatar May 21 '24 01:05 thinhnx-var

Can I assume that you suggests a feature that realm developers are able to check the amount that will be allocated in memory of the data, and how much it does cost in gas ? If I was right I will implement this feat as I am currently doing the GasUsed() funtions ✋ @notJoon

Yes, I think it would be good to show them together because the gas usage has some correlation with memory usage and vice versa. However, my intention was to make the foundation for measuring code performence like Go's pprof and prove better metrics to optimize code efficiently. So in my opinion it would better to implement them individually.

notJoon avatar May 21 '24 02:05 notJoon

Ok I understand your intention. I gonna implement this good idea within std package first. Many thanks @notJoon

thinhnx-var avatar May 21 '24 02:05 thinhnx-var