Skip to content

Commit 479a76a

Browse files
pzhan9facebook-github-bot
authored andcommitted
Add logs for dropping alloc (#561)
Summary: Pull Request resolved: #561 These logs will make it easy to tell when alloc is dropped. This information could be helpful when debugging shutdown related bugs. Reviewed By: highker Differential Revision: D78438679 fbshipit-source-id: 65db35721790001d36ff55b8d02448eb343ddce5
1 parent 1c96f6d commit 479a76a

File tree

3 files changed

+26
-0
lines changed

3 files changed

+26
-0
lines changed

hyperactor_mesh/src/alloc/local.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,16 @@ impl Alloc for LocalAlloc {
269269
}
270270
}
271271

272+
impl Drop for LocalAlloc {
273+
fn drop(&mut self) {
274+
tracing::debug!(
275+
"dropping LocalAlloc of name: {}, world id: {}",
276+
self.name,
277+
self.world_id
278+
);
279+
}
280+
}
281+
272282
#[cfg(test)]
273283
mod tests {
274284
use super::*;

hyperactor_mesh/src/alloc/process.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -504,6 +504,16 @@ impl Alloc for ProcessAlloc {
504504
}
505505
}
506506

507+
impl Drop for ProcessAlloc {
508+
fn drop(&mut self) {
509+
tracing::debug!(
510+
"dropping ProcessAlloc of name: {}, world id: {}",
511+
self.name,
512+
self.world_id
513+
);
514+
}
515+
}
516+
507517
#[cfg(test)]
508518
mod tests {
509519
use super::*;

hyperactor_mesh/src/alloc/remoteprocess.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1128,6 +1128,12 @@ impl Alloc for RemoteProcessAlloc {
11281128
}
11291129
}
11301130

1131+
impl Drop for RemoteProcessAlloc {
1132+
fn drop(&mut self) {
1133+
tracing::debug!("dropping RemoteProcessAlloc of world_id {}", self.world_id);
1134+
}
1135+
}
1136+
11311137
#[cfg(test)]
11321138
mod test {
11331139
use std::assert_matches::assert_matches;

0 commit comments

Comments
 (0)