Skip to content

Commit

Permalink
Merge pull request #805 from microsoft/bugfix-catmem-add-drop-function
Browse files Browse the repository at this point in the history
[catmem] Add Drop Function
  • Loading branch information
ppenna authored Jun 30, 2023
2 parents 3def8be + f8aad6c commit ef60c3d
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/rust/catmem/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -519,3 +519,19 @@ impl CatmemLibOS {
self.scheduler.poll()
}
}

//======================================================================================================================
// Trait Implementations
//======================================================================================================================

impl Drop for CatmemLibOS {
// Releases all sockets allocated by Catnap.
fn drop(&mut self) {
for (_, queue) in self.qtable.borrow().get_values() {
if let Err(e) = push_eof(queue.get_pipe().buffer()) {
error!("push_eof() failed: {:?}", e);
warn!("leaking shared memory region");
}
}
}
}

0 comments on commit ef60c3d

Please sign in to comment.