mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
Fix memory use after free: buffer need to be attached to the module. (#76350)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/76350 fix memory issue Test Plan: User reported ASAN errors when running `//xplat/langtech/mobile:giga5_bin` Verified with the user that rebasing to this diff it is gone. Reviewed By: pavithranrao Differential Revision: D35911894 fbshipit-source-id: 41eb88fe1501d1bb7dd9ce3d36c224c3300a41e8 (cherry picked from commit 3a13aae20f698bc5bcc4d5cb686bb36d433a2f03)
This commit is contained in:
@ -555,6 +555,7 @@ mobile::Module _load_for_mobile(
|
||||
mobile::serialization::GetMutableModule(data.get());
|
||||
mobile::Module m = initialize_mobile_module(flatbuffer_module);
|
||||
parseExtraFiles(flatbuffer_module, extra_files);
|
||||
m.set_delete_memory(data);
|
||||
return m;
|
||||
}
|
||||
#else
|
||||
@ -604,6 +605,7 @@ mobile::Module _load_for_mobile(
|
||||
mobile::serialization::GetMutableModule(data.get());
|
||||
mobile::Module m = initialize_mobile_module(flatbuffer_module);
|
||||
parseExtraFiles(flatbuffer_module, extra_files);
|
||||
m.set_delete_memory(data);
|
||||
return m;
|
||||
}
|
||||
#else
|
||||
|
Reference in New Issue
Block a user