mirror of
				https://github.com/meilisearch/meilisearch.git
				synced 2025-11-03 17:36:29 +00:00 
			
		
		
		
	Stop allocating 1GiB for documents
This commit is contained in:
		@@ -214,7 +214,7 @@ pub fn read_json(input: &File, output: impl io::Write) -> Result<u64> {
 | 
				
			|||||||
    // We memory map to be able to deserialize into a RawMap that
 | 
					    // We memory map to be able to deserialize into a RawMap that
 | 
				
			||||||
    // does not allocate when possible and only materialize the first/top level.
 | 
					    // does not allocate when possible and only materialize the first/top level.
 | 
				
			||||||
    let input = unsafe { Mmap::map(input).map_err(DocumentFormatError::Io)? };
 | 
					    let input = unsafe { Mmap::map(input).map_err(DocumentFormatError::Io)? };
 | 
				
			||||||
    let mut doc_alloc = Bump::with_capacity(1024 * 1024 * 1024); // 1MiB
 | 
					    let mut doc_alloc = Bump::with_capacity(1024 * 1024); // 1MiB
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    let mut out = BufWriter::new(output);
 | 
					    let mut out = BufWriter::new(output);
 | 
				
			||||||
    let mut deserializer = serde_json::Deserializer::from_slice(&input);
 | 
					    let mut deserializer = serde_json::Deserializer::from_slice(&input);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -70,7 +70,7 @@ impl<
 | 
				
			|||||||
        F: FnOnce(&'extractor Bump) -> Result<T>,
 | 
					        F: FnOnce(&'extractor Bump) -> Result<T>,
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        let doc_alloc =
 | 
					        let doc_alloc =
 | 
				
			||||||
            doc_allocs.get_or(|| FullySend(Cell::new(Bump::with_capacity(1024 * 1024 * 1024))));
 | 
					            doc_allocs.get_or(|| FullySend(Cell::new(Bump::with_capacity(1024 * 1024))));
 | 
				
			||||||
        let doc_alloc = doc_alloc.0.take();
 | 
					        let doc_alloc = doc_alloc.0.take();
 | 
				
			||||||
        let fields_ids_map = fields_ids_map_store
 | 
					        let fields_ids_map = fields_ids_map_store
 | 
				
			||||||
            .get_or(|| RefCell::new(GlobalFieldsIdsMap::new(new_fields_ids_map)).into());
 | 
					            .get_or(|| RefCell::new(GlobalFieldsIdsMap::new(new_fields_ids_map)).into());
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user