mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 23:58:50 +00:00
Update mem doc example formatting
This commit is contained in:
+9
-10
@@ -5,17 +5,17 @@ package mem implements various types of allocators.
|
|||||||
An example of how to use the `Tracking_Allocator` to track subsequent allocations
|
An example of how to use the `Tracking_Allocator` to track subsequent allocations
|
||||||
in your program and report leaks and bad frees:
|
in your program and report leaks and bad frees:
|
||||||
|
|
||||||
```odin
|
Example:
|
||||||
package foo
|
package foo
|
||||||
|
|
||||||
import "core:mem"
|
import "core:mem"
|
||||||
import "core:fmt"
|
import "core:fmt"
|
||||||
|
|
||||||
_main :: proc() {
|
_main :: proc() {
|
||||||
do stuff
|
// do stuff
|
||||||
}
|
}
|
||||||
|
|
||||||
main :: proc() {
|
main :: proc() {
|
||||||
track: mem.Tracking_Allocator
|
track: mem.Tracking_Allocator
|
||||||
mem.tracking_allocator_init(&track, context.allocator)
|
mem.tracking_allocator_init(&track, context.allocator)
|
||||||
defer mem.tracking_allocator_destroy(&track)
|
defer mem.tracking_allocator_destroy(&track)
|
||||||
@@ -29,7 +29,6 @@ main :: proc() {
|
|||||||
for bad_free in track.bad_free_array {
|
for bad_free in track.bad_free_array {
|
||||||
fmt.printf("%v allocation %p was freed badly\n", bad_free.location, bad_free.memory)
|
fmt.printf("%v allocation %p was freed badly\n", bad_free.location, bad_free.memory)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
|
||||||
*/
|
*/
|
||||||
package mem
|
package mem
|
||||||
|
|||||||
Reference in New Issue
Block a user