Add capability to check memory usage within the code
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
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
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.
Ok I understand your intention. I gonna implement this good idea within std package first.
Many thanks @notJoon