Skip to content

Commit 4211b72

Browse files
ndmitchellfacebook-github-bot
authored andcommitted
Fix extra_memory on string
Summary: It wasn't originally clear if the extra_memory at the end of a string entry should go under extra_memory or not. I think the answer is not, since that seems to work out better. Leave it as an explicit comment returning 0 since it's a corner case either way. Reviewed By: krallin Differential Revision: D30900300 fbshipit-source-id: 8bd01b2ad7d9b3371ec797eed794c6c49afd3b45
1 parent a0305db commit 4211b72

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

starlark/src/values/types/string.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,10 @@ impl<'v> StarlarkValue<'v> for StarlarkStr {
294294
}
295295

296296
fn extra_memory(&self) -> usize {
297-
self.len
297+
// We don't include the extra_memory for the size because it is
298+
// allocated inline in the Starlark heap (which knows about it),
299+
// not on the malloc heap.
300+
0
298301
}
299302

300303
fn length(&self) -> anyhow::Result<i32> {

0 commit comments

Comments
 (0)