Skip to content

Commit

Permalink
A rust implementation (#56)
Browse files Browse the repository at this point in the history
智能指针转裸指针故意不回收, 无限循环, 直接跟他爆了!
  • Loading branch information
DrEden33773 authored Feb 10, 2024
1 parent 296b9ee commit 9f3a397
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
18 changes: 18 additions & 0 deletions DrEden33773/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Amazing-OOM-RS

## Introduction

An extremely short executable rust implementation to f\*\*k the memory up.

## Code

```rust
fn main(){loop{Box::leak(0.into());}}
```

## Reason

1. `0.into()` simply generates a unique pointer with a clean ownership
2. `Box::leak()` simply forgets the input unique pointer's ownership, turning it into a raw pointer
3. Each time you leak a unique pointer, you don't give a try to free/drop it's load on heap memory
4. `loop{}` means this program will continue to be executed until all of the memory have been f\*\*ked up
Binary file added DrEden33773/htop.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions DrEden33773/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fn main(){loop{Box::leak(0.into());}}

0 comments on commit 9f3a397

Please sign in to comment.