gfx-rs / gfx-extras

DEPRECATED: Extra libraries to help working with gfx-hal

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Suspiciously intersecting memory ranges

kvark opened this issue · comments

Seeing this beauty:

general.rs(613) 		Size 6144, ready BitSet { mask: 1, groups: 1 }
general.rs(615) 			(0, Chunk { flavor: General(GeneralBlock { block_index: 0, chunk_index: 0, count: 1, memory: Memory { raw: Memory { raw: 0x7e000000007e }, size: 805306368, properties: CPU_VISIBLE | COHERENT, non_coherent_atom_size: None }, ptr: Some(0x7f0d3c000000), range: 0..49152 }), blocks: 192 })
general.rs(613) 		Size 49152, ready BitSet { mask: 1, groups: 1 }
general.rs(615) 			(0, Chunk { flavor: General(GeneralBlock { block_index: 0, chunk_index: 0, count: 4, memory: Memory { raw: Memory { raw: 0x7e000000007e }, size: 805306368, properties: CPU_VISIBLE | COHERENT, non_coherent_atom_size: None }, ptr: Some(0x7f0d3c000000), range: 0..393216 }), blocks: 254 })
general.rs(613) 		Size 393216, ready BitSet { mask: 1, groups: 1 }
general.rs(615) 			(0, Chunk { flavor: General(GeneralBlock { block_index: 0, chunk_index: 0, count: 4, memory: Memory { raw: Memory { raw: 0x7e000000007e }, size: 805306368, properties: CPU_VISIBLE | COHERENT, non_coherent_atom_size: None }, ptr: Some(0x7f0d3c000000), range: 0..3145728 }), blocks: 240 })
general.rs(613) 		Size 98304, ready BitSet { mask: 1, groups: 1 }
general.rs(615) 			(0, Chunk { flavor: General(GeneralBlock { block_index: 0, chunk_index: 0, count: 4, memory: Memory { raw: Memory { raw: 0x7e000000007e }, size: 805306368, properties: CPU_VISIBLE | COHERENT, non_coherent_atom_size: None }, ptr: Some(0x7f0d3c000000), range: 0..786432 }), blocks: 240 })
general.rs(613) 		Size 786432, ready BitSet { mask: 1, groups: 1 }
general.rs(615) 			(0, Chunk { flavor: General(GeneralBlock { block_index: 0, chunk_index: 0, count: 4, memory: Memory { raw: Memory { raw: 0x7e000000007e }, size: 805306368, properties: CPU_VISIBLE | COHERENT, non_coherent_atom_size: None }, ptr: Some(0x7f0d3c000000), range: 0..6291456 }), blocks: 240 })
general.rs(613) 		Size 196608, ready BitSet { mask: 1, groups: 1 }
general.rs(615) 			(0, Chunk { flavor: General(GeneralBlock { block_index: 0, chunk_index: 0, count: 4, memory: Memory { raw: Memory { raw: 0x7e000000007e }, size: 805306368, properties: CPU_VISIBLE | COHERENT, non_coherent_atom_size: None }, ptr: Some(0x7f0d3c000000), range: 0..1572864 }), blocks: 240 })
general.rs(613) 		Size 1572864, ready BitSet { mask: 1, groups: 1 }
general.rs(615) 			(0, Chunk { flavor: General(GeneralBlock { block_index: 0, chunk_index: 0, count: 4, memory: Memory { raw: Memory { raw: 0x7e000000007e }, size: 805306368, properties: CPU_VISIBLE | COHERENT, non_coherent_atom_size: None }, ptr: Some(0x7f0d3c000000), range: 0..12582912 }), blocks: 240 })
general.rs(613) 		Size 3145728, ready BitSet { mask: 1, groups: 1 }
general.rs(615) 			(0, Chunk { flavor: General(GeneralBlock { block_index: 0, chunk_index: 0, count: 4, memory: Memory { raw: Memory { raw: 0x7e000000007e }, size: 805306368, properties: CPU_VISIBLE | COHERENT, non_coherent_atom_size: None }, ptr: Some(0x7f0d3c000000), range: 0..25165824 }), blocks: 240 })
general.rs(613) 		Size 6291456, ready BitSet { mask: 1, groups: 1 }
general.rs(615) 			(0, Chunk { flavor: General(GeneralBlock { block_index: 0, chunk_index: 0, count: 4, memory: Memory { raw: Memory { raw: 0x7e000000007e }, size: 805306368, properties: CPU_VISIBLE | COHERENT, non_coherent_atom_size: None }, ptr: Some(0x7f0d3c000000), range: 0..50331648 }), blocks: 240 })
general.rs(613) 		Size 12582912, ready BitSet { mask: 1, groups: 1 }
general.rs(615) 			(0, Chunk { flavor: General(GeneralBlock { block_index: 0, chunk_index: 0, count: 4, memory: Memory { raw: Memory { raw: 0x7e000000007e }, size: 805306368, properties: CPU_VISIBLE | COHERENT, non_coherent_atom_size: None }, ptr: Some(0x7f0d3c000000), range: 0..100663296 }), blocks: 240 })
general.rs(613) 		Size 25165824, ready BitSet { mask: 1, groups: 1 }
general.rs(615) 			(0, Chunk { flavor: General(GeneralBlock { block_index: 0, chunk_index: 0, count: 4, memory: Memory { raw: Memory { raw: 0x7e000000007e }, size: 805306368, properties: CPU_VISIBLE | COHERENT, non_coherent_atom_size: None }, ptr: Some(0x7f0d3c000000), range: 0..201326592 }), blocks: 240 })
general.rs(613) 		Size 50331648, ready BitSet { mask: 1, groups: 1 }
general.rs(615) 			(0, Chunk { flavor: General(GeneralBlock { block_index: 0, chunk_index: 0, count: 4, memory: Memory { raw: Memory { raw: 0x7e000000007e }, size: 805306368, properties: CPU_VISIBLE | COHERENT, non_coherent_atom_size: None }, ptr: Some(0x7f0d3c000000), range: 0..402653184 }), blocks: 240 })
general.rs(613) 		Size 100663296, ready BitSet { mask: 1, groups: 1 }
general.rs(615) 			(0, Chunk { flavor: Dedicated { memory: Memory { raw: Memory { raw: 0x7e000000007e }, size: 805306368, properties: CPU_VISIBLE | COHERENT, non_coherent_atom_size: None }, ptr: Some(0x7f0d3c000000) }, blocks: 240 })

Need to figure out what's happening here. It could be that we only need small amount of memory but using the whole 800Mb chunk for some reason.

Turns out the intersection here is expected. The whole chain of allocation is spawned by a single small allocation. alloc_chunk tries to allocate MIN_BLOCKS_PER_CHUNK number of block sizes, doesn't find existing chunks of that 8x size, and requests a new block. This in turn leads to alloc_chunk again, and stops only when we reach the max_chunk_size...