Code Monkey home page Code Monkey logo

mandelbrot's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mandelbrot's Issues

Memory leaked

running Valgrind on simple example, returns

valgrind -s --leak-check=full --show-leak-kinds=all ./target/debug/mandelbrot test.png 1000x700 -1.20,0.35 -1.0,0.20

==194165== Memcheck, a memory error detector
==194165== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==194165== Using Valgrind-3.16.1 and LibVEX; rerun with -h for copyright info
==194165== Command: ./target/debug/mandelbrot test.png 1000x700 -1.20,0.35 -1.0,0.20
==194165== 
==194165== 
==194165== HEAP SUMMARY:
==194165==     in use at exit: 43,856 bytes in 117 blocks
==194165==   total heap usage: 247 allocs, 130 frees, 1,493,118 bytes allocated
==194165== 
==194165== 40 bytes in 1 blocks are still reachable in loss record 1 of 19
==194165==    at 0x483E77F: malloc (vg_replace_malloc.c:307)
==194165==    by 0x1BDEAC: alloc (alloc.rs:86)
==194165==    by 0x1BDEAC: alloc_impl (alloc.rs:166)
==194165==    by 0x1BDEAC: allocate (alloc.rs:226)
==194165==    by 0x1BDEAC: exchange_malloc (alloc.rs:316)
==194165==    by 0x1BDEAC: new<std::sys::unix::mutex::Mutex> (boxed.rs:186)
==194165==    by 0x1BDEAC: from<std::sys::unix::mutex::Mutex> (boxed.rs:1015)
==194165==    by 0x1BDEAC: std::sys_common::mutex::MovableMutex::new (library/std/src/sys_common/mutex.rs:64)
==194165==    by 0x17C341: std::sync::mutex::Mutex<T>::new (mutex.rs:217)
==194165==    by 0x17285D: rayon::thread_pool::Registry::new (/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-0.4.3/src/thread_pool.rs:81)
==194165==    by 0x172681: rayon::thread_pool::init_registry (/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-0.4.3/src/thread_pool.rs:58)
==194165==    by 0x172640: rayon::thread_pool::get_registry::{{closure}} (/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-0.4.3/src/thread_pool.rs:42)
==194165==    by 0x17718B: std::sync::once::Once::call_once::{{closure}} (once.rs:261)
==194165==    by 0x1BD2F1: std::sync::once::Once::call_inner (library/std/src/sync/once.rs:420)
==194165==    by 0x17710C: std::sync::once::Once::call_once (once.rs:261)
==194165==    by 0x1725F3: rayon::thread_pool::get_registry (/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-0.4.3/src/thread_pool.rs:42)
==194165==    by 0x1224C4: rayon::api::join_inject (api.rs:196)
==194165==    by 0x122923: rayon::api::join (api.rs:143)
==194165== 
==194165== 48 bytes in 1 blocks are still reachable in loss record 2 of 19
==194165==    at 0x483E77F: malloc (vg_replace_malloc.c:307)
==194165==    by 0x1BC989: alloc (alloc.rs:86)
==194165==    by 0x1BC989: alloc_impl (alloc.rs:166)
==194165==    by 0x1BC989: allocate (alloc.rs:226)
==194165==    by 0x1BC989: exchange_malloc (alloc.rs:316)
==194165==    by 0x1BC989: new<std::sys::unix::condvar::Condvar> (boxed.rs:186)
==194165==    by 0x1BC989: from<std::sys::unix::condvar::Condvar> (boxed.rs:1015)
==194165==    by 0x1BC989: new (library/std/src/sys_common/condvar.rs:19)
==194165==    by 0x1BC989: std::sync::condvar::Condvar::new (library/std/src/sync/condvar.rs:126)
==194165==    by 0x172868: rayon::thread_pool::Registry::new (/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-0.4.3/src/thread_pool.rs:82)
==194165==    by 0x172681: rayon::thread_pool::init_registry (/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-0.4.3/src/thread_pool.rs:58)
==194165==    by 0x172640: rayon::thread_pool::get_registry::{{closure}} (/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-0.4.3/src/thread_pool.rs:42)
==194165==    by 0x17718B: std::sync::once::Once::call_once::{{closure}} (once.rs:261)
==194165==    by 0x1BD2F1: std::sync::once::Once::call_inner (library/std/src/sync/once.rs:420)
==194165==    by 0x17710C: std::sync::once::Once::call_once (once.rs:261)
==194165==    by 0x1725F3: rayon::thread_pool::get_registry (/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-0.4.3/src/thread_pool.rs:42)
==194165==    by 0x1224C4: rayon::api::join_inject (api.rs:196)
==194165==    by 0x122923: rayon::api::join (api.rs:143)
==194165==    by 0x12E16D: rayon::par_iter::internal::bridge_producer_consumer (internal.rs:175)
==194165== 
==194165== 120 bytes in 1 blocks are still reachable in loss record 3 of 19
==194165==    at 0x483E77F: malloc (vg_replace_malloc.c:307)
==194165==    by 0x1788AB: alloc::alloc::alloc (alloc.rs:86)
==194165==    by 0x178969: alloc::alloc::Global::alloc_impl (alloc.rs:166)
==194165==    by 0x179239: <alloc::alloc::Global as core::alloc::Allocator>::allocate (alloc.rs:226)
==194165==    by 0x17880C: alloc::alloc::exchange_malloc (alloc.rs:316)
==194165==    by 0x170F5D: alloc::sync::Arc<T>::new (sync.rs:330)
==194165==    by 0x17291F: rayon::thread_pool::Registry::new (/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-0.4.3/src/thread_pool.rs:78)
==194165==    by 0x172681: rayon::thread_pool::init_registry (/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-0.4.3/src/thread_pool.rs:58)
==194165==    by 0x172640: rayon::thread_pool::get_registry::{{closure}} (/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-0.4.3/src/thread_pool.rs:42)
==194165==    by 0x17718B: std::sync::once::Once::call_once::{{closure}} (once.rs:261)
==194165==    by 0x1BD2F1: std::sync::once::Once::call_inner (library/std/src/sync/once.rs:420)
==194165==    by 0x17710C: std::sync::once::Once::call_once (once.rs:261)
==194165== 
==194165== 128 bytes in 1 blocks are still reachable in loss record 4 of 19
==194165==    at 0x483E77F: malloc (vg_replace_malloc.c:307)
==194165==    by 0x1788AB: alloc::alloc::alloc (alloc.rs:86)
==194165==    by 0x178969: alloc::alloc::Global::alloc_impl (alloc.rs:166)
==194165==    by 0x179239: <alloc::alloc::Global as core::alloc::Allocator>::allocate (alloc.rs:226)
==194165==    by 0x17988F: alloc::raw_vec::RawVec<T,A>::allocate_in (raw_vec.rs:188)
==194165==    by 0x17B2EC: alloc::raw_vec::RawVec<T,A>::with_capacity_in (raw_vec.rs:129)
==194165==    by 0x17943E: alloc::raw_vec::RawVec<T>::with_capacity (raw_vec.rs:93)
==194165==    by 0x182CD1: alloc::collections::vec_deque::VecDeque<T>::with_capacity (mod.rs:480)
==194165==    by 0x182FC2: alloc::collections::vec_deque::VecDeque<T>::new (mod.rs:462)
==194165==    by 0x17330E: rayon::thread_pool::RegistryState::new (/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-0.4.3/src/thread_pool.rs:192)
==194165==    by 0x172842: rayon::thread_pool::Registry::new (/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-0.4.3/src/thread_pool.rs:81)
==194165==    by 0x172681: rayon::thread_pool::init_registry (/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-0.4.3/src/thread_pool.rs:58)
==194165== 
==194165== 128 bytes in 8 blocks are still reachable in loss record 5 of 19
==194165==    at 0x483E77F: malloc (vg_replace_malloc.c:307)
==194165==    by 0x1C1FAB: alloc (alloc.rs:86)
==194165==    by 0x1C1FAB: alloc_impl (alloc.rs:166)
==194165==    by 0x1C1FAB: allocate (alloc.rs:226)
==194165==    by 0x1C1FAB: exchange_malloc (alloc.rs:316)
==194165==    by 0x1C1FAB: std::sys::unix::thread::Thread::new (library/std/src/sys/unix/thread.rs:28)
==194165==    by 0x183A3A: std::thread::Builder::spawn_unchecked (mod.rs:498)
==194165==    by 0x184207: std::thread::Builder::spawn (mod.rs:381)
==194165==    by 0x183674: std::thread::spawn (mod.rs:620)
==194165==    by 0x172B0D: rayon::thread_pool::Registry::new (/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-0.4.3/src/thread_pool.rs:87)
==194165==    by 0x172681: rayon::thread_pool::init_registry (/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-0.4.3/src/thread_pool.rs:58)
==194165==    by 0x172640: rayon::thread_pool::get_registry::{{closure}} (/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-0.4.3/src/thread_pool.rs:42)
==194165==    by 0x17718B: std::sync::once::Once::call_once::{{closure}} (once.rs:261)
==194165==    by 0x1BD2F1: std::sync::once::Once::call_inner (library/std/src/sync/once.rs:420)
==194165==    by 0x17710C: std::sync::once::Once::call_once (once.rs:261)
==194165==    by 0x1725F3: rayon::thread_pool::get_registry (/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-0.4.3/src/thread_pool.rs:42)
==194165== 
==194165== 192 bytes in 8 blocks are still reachable in loss record 6 of 19
==194165==    at 0x483E77F: malloc (vg_replace_malloc.c:307)
==194165==    by 0x1788AB: alloc::alloc::alloc (alloc.rs:86)
==194165==    by 0x178969: alloc::alloc::Global::alloc_impl (alloc.rs:166)
==194165==    by 0x179239: <alloc::alloc::Global as core::alloc::Allocator>::allocate (alloc.rs:226)
==194165==    by 0x17880C: alloc::alloc::exchange_malloc (alloc.rs:316)
==194165==    by 0x18202A: new<deque::Buffer<rayon::job::JobRef>> (boxed.rs:186)
==194165==    by 0x18202A: deque::Deque<T>::new (lib.rs:157)
==194165==    by 0x18255E: deque::new (lib.rs:127)
==194165==    by 0x172CA3: rayon::thread_pool::Registry::new::{{closure}} (/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-0.4.3/src/thread_pool.rs:76)
==194165==    by 0x17F77B: core::iter::adapters::map::map_fold::{{closure}} (map.rs:80)
==194165==    by 0x17C27E: core::iter::traits::iterator::Iterator::fold (iterator.rs:2023)
==194165==    by 0x17E827: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::fold (map.rs:120)
==194165==    by 0x17F25F: core::iter::traits::iterator::Iterator::unzip (iterator.rs:2697)
==194165== 
==194165== 256 bytes in 8 blocks are still reachable in loss record 7 of 19
==194165==    at 0x4840B65: calloc (vg_replace_malloc.c:760)
==194165==    by 0x4A46E72: __cxa_thread_atexit_impl (in /usr/lib/libc-2.33.so)
==194165==    by 0x1B8667: try_register_dtor<core::cell::RefCell<core::option::Option<std::sys_common::thread_info::ThreadInfo>>> (library/std/src/thread/local.rs:490)
==194165==    by 0x1B8667: std::thread::local::fast::Key<T>::try_initialize (library/std/src/thread/local.rs:471)
==194165==    by 0x1BE7D9: get<core::cell::RefCell<core::option::Option<std::sys_common::thread_info::ThreadInfo>>,fn() -> core::cell::RefCell<core::option::Option<std::sys_common::thread_info::ThreadInfo>>> (library/std/src/thread/local.rs:456)
==194165==    by 0x1BE7D9: __getit (library/std/src/thread/local.rs:183)
==194165==    by 0x1BE7D9: try_with<core::cell::RefCell<core::option::Option<std::sys_common::thread_info::ThreadInfo>>,closure-0,()> (library/std/src/thread/local.rs:271)
==194165==    by 0x1BE7D9: with<core::cell::RefCell<core::option::Option<std::sys_common::thread_info::ThreadInfo>>,closure-0,()> (library/std/src/thread/local.rs:248)
==194165==    by 0x1BE7D9: std::sys_common::thread_info::set (library/std/src/sys_common/thread_info.rs:40)
==194165==    by 0x183F3D: std::thread::Builder::spawn_unchecked::{{closure}} (mod.rs:472)
==194165==    by 0x174BEE: core::ops::function::FnOnce::call_once{{vtable-shim}} (function.rs:227)
==194165==    by 0x1C2399: call_once<(),FnOnce<()>,alloc::alloc::Global> (boxed.rs:1328)
==194165==    by 0x1C2399: call_once<(),alloc::boxed::Box<FnOnce<()>, alloc::alloc::Global>,alloc::alloc::Global> (boxed.rs:1328)
==194165==    by 0x1C2399: std::sys::unix::thread::Thread::new::thread_start (library/std/src/sys/unix/thread.rs:71)
==194165==    by 0x48A3298: start_thread (in /usr/lib/libpthread-2.33.so)
==194165==    by 0x4B06052: clone (in /usr/lib/libc-2.33.so)
==194165== 
==194165== 256 bytes in 8 blocks are still reachable in loss record 8 of 19
==194165==    at 0x4840B65: calloc (vg_replace_malloc.c:760)
==194165==    by 0x4A46E72: __cxa_thread_atexit_impl (in /usr/lib/libc-2.33.so)
==194165==    by 0x18D9B1: std::thread::local::fast::Key<T>::try_register_dtor (local.rs:490)
==194165==    by 0x18D8C2: std::thread::local::fast::Key<T>::try_initialize (local.rs:471)
==194165==    by 0x18DA4A: std::thread::local::fast::Key<T>::get (local.rs:456)
==194165==    by 0x191B2C: rand::thread_rng::THREAD_RNG_KEY::__getit (local.rs:183)
==194165==    by 0x18D79A: std::thread::local::LocalKey<T>::try_with (local.rs:271)
==194165==    by 0x18D73E: std::thread::local::LocalKey<T>::with (local.rs:248)
==194165==    by 0x191813: rand::thread_rng (/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/rand-0.4.6/src/lib.rs:898)
==194165==    by 0x1915AC: rand::weak_rng (/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/rand-0.4.6/src/lib.rs:843)
==194165==    by 0x1739E4: rayon::thread_pool::main_loop (/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-0.4.3/src/thread_pool.rs:326)
==194165==    by 0x172D03: rayon::thread_pool::Registry::new::{{closure}} (/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-0.4.3/src/thread_pool.rs:87)
==194165== 
==194165== 320 bytes in 1 blocks are still reachable in loss record 9 of 19
==194165==    at 0x483E77F: malloc (vg_replace_malloc.c:307)
==194165==    by 0x1788AB: alloc::alloc::alloc (alloc.rs:86)
==194165==    by 0x178969: alloc::alloc::Global::alloc_impl (alloc.rs:166)
==194165==    by 0x179239: <alloc::alloc::Global as core::alloc::Allocator>::allocate (alloc.rs:226)
==194165==    by 0x179F0F: alloc::raw_vec::RawVec<T,A>::allocate_in (raw_vec.rs:188)
==194165==    by 0x17B32C: alloc::raw_vec::RawVec<T,A>::with_capacity_in (raw_vec.rs:129)
==194165==    by 0x185C8E: alloc::vec::Vec<T,A>::with_capacity_in (vec.rs:498)
==194165==    by 0x1855D5: alloc::vec::Vec<T>::with_capacity (vec.rs:364)
==194165==    by 0x187267: <alloc::vec::Vec<T> as alloc::vec::SpecFromIterNested<T,I>>::from_iter (vec.rs:2331)
==194165==    by 0x186AE1: <alloc::vec::Vec<T> as alloc::vec::SpecFromIter<T,I>>::from_iter (vec.rs:2451)
==194165==    by 0x187EE6: <alloc::vec::Vec<T> as core::iter::traits::collect::FromIterator<T>>::from_iter (vec.rs:2181)
==194165==    by 0x17F3D8: core::iter::traits::iterator::Iterator::collect (iterator.rs:1670)
==194165== 
==194165== 320 bytes in 8 blocks are still reachable in loss record 10 of 19
==194165==    at 0x483E77F: malloc (vg_replace_malloc.c:307)
==194165==    by 0x1788AB: alloc::alloc::alloc (alloc.rs:86)
==194165==    by 0x178969: alloc::alloc::Global::alloc_impl (alloc.rs:166)
==194165==    by 0x179239: <alloc::alloc::Global as core::alloc::Allocator>::allocate (alloc.rs:226)
==194165==    by 0x17880C: alloc::alloc::exchange_malloc (alloc.rs:316)
==194165==    by 0x171157: alloc::sync::Arc<T>::new (sync.rs:330)
==194165==    by 0x182569: deque::new (lib.rs:127)
==194165==    by 0x172CA3: rayon::thread_pool::Registry::new::{{closure}} (/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-0.4.3/src/thread_pool.rs:76)
==194165==    by 0x17F77B: core::iter::adapters::map::map_fold::{{closure}} (map.rs:80)
==194165==    by 0x17C27E: core::iter::traits::iterator::Iterator::fold (iterator.rs:2023)
==194165==    by 0x17E827: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::fold (map.rs:120)
==194165==    by 0x17F25F: core::iter::traits::iterator::Iterator::unzip (iterator.rs:2697)
==194165== 
==194165== 320 bytes in 8 blocks are still reachable in loss record 11 of 19
==194165==    at 0x483E77F: malloc (vg_replace_malloc.c:307)
==194165==    by 0x1BDEAC: alloc (alloc.rs:86)
==194165==    by 0x1BDEAC: alloc_impl (alloc.rs:166)
==194165==    by 0x1BDEAC: allocate (alloc.rs:226)
==194165==    by 0x1BDEAC: exchange_malloc (alloc.rs:316)
==194165==    by 0x1BDEAC: new<std::sys::unix::mutex::Mutex> (boxed.rs:186)
==194165==    by 0x1BDEAC: from<std::sys::unix::mutex::Mutex> (boxed.rs:1015)
==194165==    by 0x1BDEAC: std::sys_common::mutex::MovableMutex::new (library/std/src/sys_common/mutex.rs:64)
==194165==    by 0x17C484: std::sync::mutex::Mutex<T>::new (mutex.rs:217)
==194165==    by 0x17E3ED: rayon::latch::LockLatch::new (/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-0.4.3/src/latch.rs:57)
==194165==    by 0x173371: rayon::thread_pool::ThreadInfo::new (/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-0.4.3/src/thread_pool.rs:208)
==194165==    by 0x172CDC: rayon::thread_pool::Registry::new::{{closure}} (/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-0.4.3/src/thread_pool.rs:79)
==194165==    by 0x17F845: core::iter::adapters::map::map_fold::{{closure}} (map.rs:80)
==194165==    by 0x1851E4: core::iter::traits::iterator::Iterator::fold (iterator.rs:2023)
==194165==    by 0x17E768: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::fold (map.rs:120)
==194165==    by 0x17F499: core::iter::traits::iterator::Iterator::for_each (iterator.rs:678)
==194165==    by 0x1870E2: <alloc::vec::Vec<T,A> as alloc::vec::SpecExtend<T,I>>::spec_extend (vec.rs:2568)
==194165==    by 0x187299: <alloc::vec::Vec<T> as alloc::vec::SpecFromIterNested<T,I>>::from_iter (vec.rs:2336)
==194165== 
==194165== 320 bytes in 8 blocks are still reachable in loss record 12 of 19
==194165==    at 0x483E77F: malloc (vg_replace_malloc.c:307)
==194165==    by 0x1788AB: alloc::alloc::alloc (alloc.rs:86)
==194165==    by 0x178969: alloc::alloc::Global::alloc_impl (alloc.rs:166)
==194165==    by 0x179239: <alloc::alloc::Global as core::alloc::Allocator>::allocate (alloc.rs:226)
==194165==    by 0x17880C: alloc::alloc::exchange_malloc (alloc.rs:316)
==194165==    by 0x170DE7: alloc::sync::Arc<T>::new (sync.rs:330)
==194165==    by 0x183844: std::thread::Builder::spawn_unchecked (mod.rs:456)
==194165==    by 0x184207: std::thread::Builder::spawn (mod.rs:381)
==194165==    by 0x183674: std::thread::spawn (mod.rs:620)
==194165==    by 0x172B0D: rayon::thread_pool::Registry::new (/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-0.4.3/src/thread_pool.rs:87)
==194165==    by 0x172681: rayon::thread_pool::init_registry (/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-0.4.3/src/thread_pool.rs:58)
==194165==    by 0x172640: rayon::thread_pool::get_registry::{{closure}} (/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-0.4.3/src/thread_pool.rs:42)
==194165== 
==194165== 384 bytes in 8 blocks are still reachable in loss record 13 of 19
==194165==    at 0x483E77F: malloc (vg_replace_malloc.c:307)
==194165==    by 0x1BC989: alloc (alloc.rs:86)
==194165==    by 0x1BC989: alloc_impl (alloc.rs:166)
==194165==    by 0x1BC989: allocate (alloc.rs:226)
==194165==    by 0x1BC989: exchange_malloc (alloc.rs:316)
==194165==    by 0x1BC989: new<std::sys::unix::condvar::Condvar> (boxed.rs:186)
==194165==    by 0x1BC989: from<std::sys::unix::condvar::Condvar> (boxed.rs:1015)
==194165==    by 0x1BC989: new (library/std/src/sys_common/condvar.rs:19)
==194165==    by 0x1BC989: std::sync::condvar::Condvar::new (library/std/src/sync/condvar.rs:126)
==194165==    by 0x17E414: rayon::latch::LockLatch::new (/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-0.4.3/src/latch.rs:58)
==194165==    by 0x173371: rayon::thread_pool::ThreadInfo::new (/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-0.4.3/src/thread_pool.rs:208)
==194165==    by 0x172CDC: rayon::thread_pool::Registry::new::{{closure}} (/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-0.4.3/src/thread_pool.rs:79)
==194165==    by 0x17F845: core::iter::adapters::map::map_fold::{{closure}} (map.rs:80)
==194165==    by 0x1851E4: core::iter::traits::iterator::Iterator::fold (iterator.rs:2023)
==194165==    by 0x17E768: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::fold (map.rs:120)
==194165==    by 0x17F499: core::iter::traits::iterator::Iterator::for_each (iterator.rs:678)
==194165==    by 0x1870E2: <alloc::vec::Vec<T,A> as alloc::vec::SpecExtend<T,I>>::spec_extend (vec.rs:2568)
==194165==    by 0x187299: <alloc::vec::Vec<T> as alloc::vec::SpecFromIterNested<T,I>>::from_iter (vec.rs:2336)
==194165==    by 0x186AE1: <alloc::vec::Vec<T> as alloc::vec::SpecFromIter<T,I>>::from_iter (vec.rs:2451)
==194165== 
==194165== 384 bytes in 8 blocks are still reachable in loss record 14 of 19
==194165==    at 0x483E77F: malloc (vg_replace_malloc.c:307)
==194165==    by 0x1B88B2: alloc (alloc.rs:86)
==194165==    by 0x1B88B2: alloc_impl (alloc.rs:166)
==194165==    by 0x1B88B2: allocate (alloc.rs:226)
==194165==    by 0x1B88B2: exchange_malloc (alloc.rs:316)
==194165==    by 0x1B88B2: new<std::thread::Inner> (sync.rs:330)
==194165==    by 0x1B88B2: std::thread::Thread::new (library/std/src/thread/mod.rs:1061)
==194165==    by 0x1837CF: std::thread::Builder::spawn_unchecked (mod.rs:453)
==194165==    by 0x184207: std::thread::Builder::spawn (mod.rs:381)
==194165==    by 0x183674: std::thread::spawn (mod.rs:620)
==194165==    by 0x172B0D: rayon::thread_pool::Registry::new (/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-0.4.3/src/thread_pool.rs:87)
==194165==    by 0x172681: rayon::thread_pool::init_registry (/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-0.4.3/src/thread_pool.rs:58)
==194165==    by 0x172640: rayon::thread_pool::get_registry::{{closure}} (/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-0.4.3/src/thread_pool.rs:42)
==194165==    by 0x17718B: std::sync::once::Once::call_once::{{closure}} (once.rs:261)
==194165==    by 0x1BD2F1: std::sync::once::Once::call_inner (library/std/src/sync/once.rs:420)
==194165==    by 0x17710C: std::sync::once::Once::call_once (once.rs:261)
==194165==    by 0x1725F3: rayon::thread_pool::get_registry (/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-0.4.3/src/thread_pool.rs:42)
==194165== 
==194165== 384 bytes in 8 blocks are still reachable in loss record 15 of 19
==194165==    at 0x483E77F: malloc (vg_replace_malloc.c:307)
==194165==    by 0x1788AB: alloc::alloc::alloc (alloc.rs:86)
==194165==    by 0x178969: alloc::alloc::Global::alloc_impl (alloc.rs:166)
==194165==    by 0x179239: <alloc::alloc::Global as core::alloc::Allocator>::allocate (alloc.rs:226)
==194165==    by 0x17880C: alloc::alloc::exchange_malloc (alloc.rs:316)
==194165==    by 0x1839B9: new<closure-0> (boxed.rs:186)
==194165==    by 0x1839B9: std::thread::Builder::spawn_unchecked (mod.rs:501)
==194165==    by 0x184207: std::thread::Builder::spawn (mod.rs:381)
==194165==    by 0x183674: std::thread::spawn (mod.rs:620)
==194165==    by 0x172B0D: rayon::thread_pool::Registry::new (/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-0.4.3/src/thread_pool.rs:87)
==194165==    by 0x172681: rayon::thread_pool::init_registry (/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-0.4.3/src/thread_pool.rs:58)
==194165==    by 0x172640: rayon::thread_pool::get_registry::{{closure}} (/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-0.4.3/src/thread_pool.rs:42)
==194165==    by 0x17718B: std::sync::once::Once::call_once::{{closure}} (once.rs:261)
==194165== 
==194165== 512 bytes in 8 blocks are still reachable in loss record 16 of 19
==194165==    at 0x4840D7B: realloc (vg_replace_malloc.c:834)
==194165==    by 0x18C89C: alloc::alloc::realloc (alloc.rs:122)
==194165==    by 0x18C57C: alloc::alloc::Global::grow_impl (alloc.rs:198)
==194165==    by 0x18CCE3: <alloc::alloc::Global as core::alloc::Allocator>::grow (alloc.rs:251)
==194165==    by 0x18817C: alloc::raw_vec::finish_grow (raw_vec.rs:487)
==194165==    by 0x17B1AF: alloc::raw_vec::RawVec<T,A>::grow_amortized (raw_vec.rs:422)
==194165==    by 0x17A113: alloc::raw_vec::RawVec<T,A>::try_reserve (raw_vec.rs:311)
==194165==    by 0x17B892: alloc::raw_vec::RawVec<T,A>::reserve (raw_vec.rs:305)
==194165==    by 0x1860B8: alloc::vec::Vec<T,A>::reserve (vec.rs:697)
==194165==    by 0x1858B5: alloc::vec::Vec<T,A>::extend_desugared (vec.rs:2625)
==194165==    by 0x187163: <alloc::vec::Vec<T,A> as alloc::vec::SpecExtend<T,I>>::spec_extend (vec.rs:2544)
==194165==    by 0x187461: <alloc::vec::Vec<T> as alloc::vec::SpecFromIterNested<T,I>>::from_iter (vec.rs:2320)
==194165== 
==194165== 2,304 bytes in 8 blocks are possibly lost in loss record 17 of 19
==194165==    at 0x4840B65: calloc (vg_replace_malloc.c:760)
==194165==    by 0x4012E8B: _dl_allocate_tls (in /usr/lib/ld-2.33.so)
==194165==    by 0x48A4016: pthread_create@@GLIBC_2.2.5 (in /usr/lib/libpthread-2.33.so)
==194165==    by 0x1C20B1: std::sys::unix::thread::Thread::new (library/std/src/sys/unix/thread.rs:50)
==194165==    by 0x183A3A: std::thread::Builder::spawn_unchecked (mod.rs:498)
==194165==    by 0x184207: std::thread::Builder::spawn (mod.rs:381)
==194165==    by 0x183674: std::thread::spawn (mod.rs:620)
==194165==    by 0x172B0D: rayon::thread_pool::Registry::new (/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-0.4.3/src/thread_pool.rs:87)
==194165==    by 0x172681: rayon::thread_pool::init_registry (/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-0.4.3/src/thread_pool.rs:58)
==194165==    by 0x172640: rayon::thread_pool::get_registry::{{closure}} (/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-0.4.3/src/thread_pool.rs:42)
==194165==    by 0x17718B: std::sync::once::Once::call_once::{{closure}} (once.rs:261)
==194165==    by 0x1BD2F1: std::sync::once::Once::call_inner (library/std/src/sync/once.rs:420)
==194165== 
==194165== 4,096 bytes in 8 blocks are still reachable in loss record 18 of 19
==194165==    at 0x483E77F: malloc (vg_replace_malloc.c:307)
==194165==    by 0x1788AB: alloc::alloc::alloc (alloc.rs:86)
==194165==    by 0x178969: alloc::alloc::Global::alloc_impl (alloc.rs:166)
==194165==    by 0x179239: <alloc::alloc::Global as core::alloc::Allocator>::allocate (alloc.rs:226)
==194165==    by 0x17988F: alloc::raw_vec::RawVec<T,A>::allocate_in (raw_vec.rs:188)
==194165==    by 0x17B2EC: alloc::raw_vec::RawVec<T,A>::with_capacity_in (raw_vec.rs:129)
==194165==    by 0x185BCE: alloc::vec::Vec<T,A>::with_capacity_in (vec.rs:498)
==194165==    by 0x1855B5: alloc::vec::Vec<T>::with_capacity (vec.rs:364)
==194165==    by 0x182610: deque::allocate (lib.rs:275)
==194165==    by 0x1823B3: deque::Buffer<T>::new (lib.rs:287)
==194165==    by 0x18201B: deque::Deque<T>::new (lib.rs:157)
==194165==    by 0x18255E: deque::new (lib.rs:127)
==194165== 
==194165== 33,344 bytes in 8 blocks are still reachable in loss record 19 of 19
==194165==    at 0x483E77F: malloc (vg_replace_malloc.c:307)
==194165==    by 0x197F8B: alloc::alloc::alloc (alloc.rs:86)
==194165==    by 0x198049: alloc::alloc::Global::alloc_impl (alloc.rs:166)
==194165==    by 0x198C29: <alloc::alloc::Global as core::alloc::Allocator>::allocate (alloc.rs:226)
==194165==    by 0x197EEC: alloc::alloc::exchange_malloc (alloc.rs:316)
==194165==    by 0x199293: alloc::rc::Rc<T>::new (rc.rs:345)
==194165==    by 0x191AC1: rand::thread_rng::THREAD_RNG_KEY::__init (/home/horky/.cargo/registry/src/github.com-1ecc6299db9ec823/rand-0.4.6/src/lib.rs:895)
==194165==    by 0x194FB8: core::ops::function::FnOnce::call_once (function.rs:227)
==194165==    by 0x18F6D8: std::thread::local::lazy::LazyKeyInner<T>::initialize (local.rs:304)
==194165==    by 0x18D905: std::thread::local::fast::Key<T>::try_initialize (local.rs:473)
==194165==    by 0x18DA4A: std::thread::local::fast::Key<T>::get (local.rs:456)
==194165==    by 0x191B2C: rand::thread_rng::THREAD_RNG_KEY::__getit (local.rs:183)
==194165== 
==194165== LEAK SUMMARY:
==194165==    definitely lost: 0 bytes in 0 blocks
==194165==    indirectly lost: 0 bytes in 0 blocks
==194165==      possibly lost: 2,304 bytes in 8 blocks
==194165==    still reachable: 41,552 bytes in 109 blocks
==194165==         suppressed: 0 bytes in 0 blocks
==194165== 
==194165== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)

Branches give compile errors

I tried to clone and builld the following branches:

  • single-threaded
  • bands
  • rayon
    All of those branches using 'cargo build' give compile errors.

confusing the var name.

I think it is more clearly to understand, bounds.0 equal width and you used it square width / bounds.0.
for row in 0..bounds.0 {
for column in 0..bounds.1 {
let point = pixel_to_point(bounds, (row, column),
upper_left, lower_right);
pixels[column * bounds.0 + row] =
match escape_time(point, 255) {
None => 0,
Some(count) => 255 - count as u8
};
}
}

does not build on current stable 1.75.0

did a clone of the repository. following the book.
tried to build and got this (the error happens far before we reach Mandelbrot's code)

gf@aesir:~/Documents/004-books/001-rust/ProgRustSources/mandelbrot$ cargo build --release
Updating crates.io index
Downloaded autocfg v1.0.1
Downloaded enum_primitive v0.1.1
Downloaded scoped_threadpool v0.1.9
Downloaded nodrop v0.1.13
Downloaded crossbeam-queue v0.1.2
Downloaded num-integer v0.1.44
Downloaded num v0.4.0
Downloaded num-iter v0.1.42
Downloaded crossbeam-deque v0.7.1
Downloaded arrayvec v0.4.11
Downloaded memoffset v0.5.1
Downloaded adler32 v1.0.3
Downloaded color_quant v1.0.1
Downloaded num-traits v0.1.43
Downloaded cfg-if v0.1.9
Downloaded num-rational v0.4.0
Downloaded num-traits v0.2.14
Downloaded either v1.5.2
Downloaded byteorder v1.3.2
Downloaded gif v0.9.2
Downloaded lzw v0.10.0
Downloaded num_cpus v1.10.1
Downloaded inflate v0.2.0
Downloaded scopeguard v1.0.0
Downloaded num-rational v0.1.42
Downloaded bitflags v0.7.0
Downloaded jpeg-decoder v0.1.16
Downloaded crossbeam-utils v0.6.6
Downloaded num-bigint v0.4.0
Downloaded png v0.7.0
Downloaded num-complex v0.4.0
Downloaded deflate v0.7.20
Downloaded crossbeam-epoch v0.7.2
Downloaded rayon-core v1.6.0
Downloaded image v0.13.0
Downloaded rayon v1.2.0
Downloaded libc v0.2.62
Downloaded 37 crates (1.5 MB) in 6.46s
Compiling autocfg v1.0.1
Compiling semver-parser v0.7.0
Compiling lazy_static v1.4.0
Compiling cfg-if v0.1.9
Compiling arrayvec v0.4.11
Compiling nodrop v0.1.13
Compiling libc v0.2.62
Compiling byteorder v1.3.2
Compiling scopeguard v1.0.0
Compiling rayon-core v1.6.0
Compiling either v1.5.2
Compiling adler32 v1.0.3
Compiling lzw v0.10.0
Compiling bitflags v0.7.0
Compiling inflate v0.2.0
Compiling color_quant v1.0.1
Compiling scoped_threadpool v0.1.9
Compiling crossbeam-utils v0.6.6
Compiling semver v0.9.0
Compiling gif v0.9.2
Compiling num-traits v0.2.14
Compiling num-integer v0.1.44
Compiling rustc_version v0.2.3
Compiling num-iter v0.1.42
Compiling num-bigint v0.4.0
Compiling num-rational v0.4.0
Compiling crossbeam-queue v0.1.2
Compiling memoffset v0.5.1
Compiling deflate v0.7.20
Compiling num_cpus v1.10.1
Compiling crossbeam-epoch v0.7.2
Compiling crossbeam-deque v0.7.1
Compiling num-traits v0.1.43
Compiling num-complex v0.4.0
Compiling enum_primitive v0.1.1
Compiling rayon v1.2.0
Compiling num-rational v0.1.42
Compiling png v0.7.0
error[E0308]: mismatched types
--> /home/gf/.cargo/registry/src/index.crates.io-6f17d22bba15001f/num-bigint-0.4.0/src/biguint/convert.rs:70:19
|
70 | .div_ceil(&big_digit::BITS.into())
| -------- ^^^^^^^^^^^^^^^^^^^^^^^ expected u64, found &_
| |
| arguments to this method are incorrect
|
= note: expected type u64
found reference &_
note: method defined here
--> /home/gf/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/num/mod.rs:1169:5
|
1169 | / uint_impl! {
1170 | | Self = u64,
1171 | | ActualT = u64,
1172 | | SignedT = i64,
... |
1186 | | bound_condition = "",
1187 | | }
| |_____^
= note: this error originates in the macro uint_impl (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider removing the borrow
|
70 - .div_ceil(&big_digit::BITS.into())
70 + .div_ceil(big_digit::BITS.into())
|

error[E0308]: mismatched types
--> /home/gf/.cargo/registry/src/index.crates.io-6f17d22bba15001f/num-bigint-0.4.0/src/biguint/convert.rs:585:19
|
585 | .div_ceil(&u64::from(bits))
| -------- ^^^^^^^^^^^^^^^^ expected u64, found &u64
| |
| arguments to this method are incorrect
|
note: method defined here
--> /home/gf/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/num/mod.rs:1169:5
|
1169 | / uint_impl! {
1170 | | Self = u64,
1171 | | ActualT = u64,
1172 | | SignedT = i64,
... |
1186 | | bound_condition = "",
1187 | | }
| |_____^
= note: this error originates in the macro uint_impl (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider removing the borrow
|
585 - .div_ceil(&u64::from(bits))
585 + .div_ceil(u64::from(bits))
|

error[E0308]: mismatched types
--> /home/gf/.cargo/registry/src/index.crates.io-6f17d22bba15001f/num-bigint-0.4.0/src/biguint/convert.rs:613:19
|
613 | .div_ceil(&u64::from(bits))
| -------- ^^^^^^^^^^^^^^^^ expected u64, found &u64
| |
| arguments to this method are incorrect
|
note: method defined here
--> /home/gf/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/num/mod.rs:1169:5
|
1169 | / uint_impl! {
1170 | | Self = u64,
1171 | | ActualT = u64,
1172 | | SignedT = i64,
... |
1186 | | bound_condition = "",
1187 | | }
| |_____^
= note: this error originates in the macro uint_impl (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider removing the borrow
|
613 - .div_ceil(&u64::from(bits))
613 + .div_ceil(u64::from(bits))
|

error[E0308]: mismatched types
--> /home/gf/.cargo/registry/src/index.crates.io-6f17d22bba15001f/num-bigint-0.4.0/src/biguint.rs:398:54
|
398 | let root_scale = extra_bits.div_ceil(&n64);
| -------- ^^^^ expected u64, found &u64
| |
| arguments to this method are incorrect
|
note: method defined here
--> /home/gf/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/num/mod.rs:1169:5
|
1169 | / uint_impl! {
1170 | | Self = u64,
1171 | | ActualT = u64,
1172 | | SignedT = i64,
... |
1186 | | bound_condition = "",
1187 | | }
| |_____^
= note: this error originates in the macro uint_impl (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider removing the borrow
|
398 - let root_scale = extra_bits.div_ceil(&n64);
398 + let root_scale = extra_bits.div_ceil(n64);
|

For more information about this error, try rustc --explain E0308.
error: could not compile num-bigint (lib) due to 4 previous errors
warning: build failed, waiting for other jobs to finish...

The naming of the arguments is confusing

You specify the arguments as:

Usage: mandelbrot FILE PIXELS UPPERLEFT LOWERRIGHT

But what it actually is, is the corner values are inverted from how they are described:

Usage: mandelbrot FILE PIXELS <LEFT,TOP> <RIGHT,BOTTOM>

Even easier to understand is to use common CSS terminology and split them out:

Usage: mandelbrot FILE PIXELS TOP RIGHT BOTTOM LEFT - but that would obviously require a code change.

serialize and error[E0642]

Having problems to compile:

$ cargo clean
$ rustup -V
rustup 1.10.0 (c6a8f7c60 2018-01-25)
$ rustup toolchain list
stable-x86_64-unknown-linux-gnu (default)
nightly-x86_64-unknown-linux-gnu
$ cargo check
$ cargo check
   Compiling rustc-serialize v0.3.19
   Compiling deque v0.3.1
   Compiling num-iter v0.1.32
   Compiling miniz-sys v0.1.7
error[E0642]: patterns aren't allowed in methods without bodies
   --> /home/jan/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-serialize-0.3.19/src/serialize.rs:147:45
    |
147 |                                             &f_name: &str,
    |                                             ^^^^^^^

   Compiling rayon v0.4.0
   Compiling flate2 v0.2.14
   Compiling jpeg-decoder v0.1.6
   Compiling png v0.5.2
error: aborting due to previous error

error: Could not compile `rustc-serialize`.

To learn more, run the command again with --verbose.

P.S.: Thanks for the Programming Rust book. I'm really enjoying it so far ...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.