Is there a way to limit the amount of memory usage/growth during a unit test in golang?
For example, in java, we can do:
long before = Runtime.getRuntime().freeMemory()
// allocate a bunch of memory
long after = Runtime.getRuntime().freeMemory()
Assert.AssertTrue(before-after < 100)
(roughly) to assert that we didn't use more than 100 bytes.
Aucun commentaire:
Enregistrer un commentaire