damccorm commented on code in PR #37214:
URL: https://github.com/apache/beam/pull/37214#discussion_r2662857085
##########
sdks/typescript/src/apache_beam/worker/state.ts:
##########
@@ -46,25 +46,87 @@ export interface StateProvider {
}
// TODO: (Advanced) Cross-bundle caching.
+/**
+ * Wrapper for cached values that tracks their weight (memory size).
+ */
+interface WeightedCacheEntry<T> {
+ entry: MaybePromise<T>;
+ weight: number;
+}
+
+/**
+ * Estimates the memory size of a value in bytes.
+ * This is a simplified estimation - actual memory usage may vary.
+ */
+function estimateSize(value: any): number {
Review Comment:
Can we just use https://www.npmjs.com/package/object-sizeof?activeTab=readme
?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]