llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
29.03k stars 11.97k forks source link

MCJIT/RuntimeDyld memory usage is inefficient. #17170

Open andykaylor opened 11 years ago

andykaylor commented 11 years ago
Bugzilla Link 16796
Version trunk
OS All
CC @atrick,@lhames

Extended Description

MCJIT and RuntimeDyld are currently fairly sloppy in their use of memory. Several objects that are only needed during the compiling and loading phases are kept in memory throughout the lifetime of the MCJIT engine. This makes use of MCJIT prohibitively expensive on devices where memory is limited.

andykaylor commented 11 years ago

This was improved a bit in r191722. As of that revision, relocation entries are dropped after they are applied, which helps a lot in the case of a client with many small modules. There are definitely more opportunities for low cost, high return improvements. Discarding the initially generated object image after loading is complete is one possibility (though it would require fixing the problem with debugger registration happening at the wrong layer). It should also be possible to discard IR objects after code has been generated.