-
Notifications
You must be signed in to change notification settings - Fork 293
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement memory tracking for Blob/File/Streams #1608
Conversation
a9982b1
to
94da874
Compare
dbd624a
to
dbe4e03
Compare
94da874
to
f5dbaa7
Compare
dbe4e03
to
d84952a
Compare
f5dbaa7
to
8729a72
Compare
736599d
to
fd52869
Compare
8729a72
to
13de7bd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
KJ_SWITCH_ONEOF(ownData) { | ||
KJ_CASE_ONEOF(data, kj::Array<byte>) { | ||
tracker.trackField("ownData", data); | ||
} | ||
KJ_CASE_ONEOF(data, jsg::Ref<Blob>) { | ||
tracker.trackField("ownData", data); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be convenient if there were a way to call trackField
with a kj::OneOf<S, T, ...>
where there is an impl for trackField
for each of them. Perhaps it's not worth the hassle to save a little bit of boilerplate.
But maybe you could make a concept Trackable
with T::trackField(tracker, name, value)
and then define tracker.trackField<Trackable T>
to call T::trackField
. Then maybe you can define OneOf<Trackable S, Trackable T, Trackable U>::trackField
or something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd considered adding that but I think I prefer separating it out like this in order to give a bit more control over how things are tracked. In some cases, it won't need to be tracked at all, in other cases it make use trackField(...)
for one and trackFieldWithSize(...)
for others.
No description provided.