mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-21 23:18:12 +08:00
Reduce history system's excessive memory usage from storing copies of images each step (#845)
* Limit saved undo history * Do not commit path every mouse move event * Reference count images in history system instead of cloning the image data * Increase history storage step limit to 100 Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
co-authored by
Keavon Chambers
parent
be353878d0
commit
4cda84521f
@@ -32,7 +32,7 @@ pub fn set_random_seed(seed: u64) {
|
||||
/// This avoids creating a json with a list millions of numbers long.
|
||||
#[wasm_bindgen(module = "@/wasm-communication/editor")]
|
||||
extern "C" {
|
||||
fn updateImage(path: Vec<u64>, mime: String, imageData: Vec<u8>, document_id: u64);
|
||||
fn updateImage(path: Vec<u64>, mime: String, imageData: &[u8], document_id: u64);
|
||||
}
|
||||
|
||||
/// Provides a handle to access the raw WASM memory
|
||||
@@ -100,7 +100,7 @@ impl JsEditorHandle {
|
||||
// Special case for update image data to avoid serialization times.
|
||||
if let FrontendMessage::UpdateImageData { document_id, image_data } = message {
|
||||
for image in image_data {
|
||||
updateImage(image.path, image.mime, image.image_data, document_id);
|
||||
updateImage(image.path, image.mime, &image.image_data, document_id);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user