Skip to content

Commit 4e1817e

Browse files
committed
Implement unmanaged_size for VMArray REPR.
1 parent a6fa12b commit 4e1817e

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/6model/reprs/MVMArray.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1194,6 +1194,13 @@ static void spesh(MVMThreadContext *tc, MVMSTable *st, MVMSpeshGraph *g, MVMSpes
11941194
}
11951195
}
11961196

1197+
/* Calculates the non-GC-managed memory we hold on to. */
1198+
MVMuint64 unmanaged_size(MVMThreadContext *tc, MVMSTable *st, void *data) {
1199+
MVMArrayREPRData *repr_data = (MVMArrayREPRData *) st->REPR_data;
1200+
MVMArrayBody *body = (MVMArrayBody *)data;
1201+
return body->ssize * repr_data->elem_size;
1202+
}
1203+
11971204
/* Initializes the representation. */
11981205
const MVMREPROps * MVMArray_initialize(MVMThreadContext *tc) {
11991206
return &this_repr;
@@ -1240,5 +1247,5 @@ static const MVMREPROps this_repr = {
12401247
"VMArray", /* name */
12411248
MVM_REPR_ID_MVMArray,
12421249
0, /* refs_frames */
1243-
NULL, /* unmanaged_size */
1250+
unmanaged_size,
12441251
};

0 commit comments

Comments
 (0)