ssut / payload-dumper-go

an android OTA payload dumper written in Go
Apache License 2.0
2.36k stars 201 forks source link

fix: memory leak #7

Closed luca020400 closed 3 years ago

luca020400 commented 3 years ago

TL; DR: Fixes memory leak that make it use ~6GB of RAM while extracting a payload, now it uses ~1.7GB

Edit: this is VIRT RAM, real RAM usage is lower ( 4GB -> 40MB )

luca020400 commented 3 years ago

Ideally we'd be using a golang xz impl (https://github.com/ulikunitz/xz) , but it's rather slow compared to this C one. Still requiring lzma to be installed kinda sucks.

ssut commented 3 years ago

Thanks for your contribution. Anyway, the reason I didn't use https://github.com/ulikunitz/xz is written in https://github.com/ssut/payload-dumper-go/issues/3#issuecomment-811729853.

luca020400 commented 3 years ago

Yeah, I switched to it as a test and all the output files are somehow broken. Not sure how is possible given the sha/block size checks never fail.

Either way, the impl is also shower