Dont retain `Linkable` from `LoaderState`
## Summary
In `LoaderState`, we record the already linked `Linkable`s to later record the `Usage`
```haskell
-- compiler/GHC/Linker/Types.hs
data LoaderState = LoaderState
{ bco_loader_state :: !BytecodeLoaderState
-- ^ Information about bytecode objects we have loaded into the
-- interpreter.
, bcos_loaded :: !LinkableSet
-- ^ The currently loaded interpreted modules (home package)
, objs_loaded :: !LinkableSet
-- ^ And the currently-loaded compiled modules (home package)
, pkgs_loaded :: !PkgsLoaded
-- ^ The currently-loaded packages;
-- haskell libraries, system libraries, transitive dependencies
, temp_sos :: ![(FilePath, String)]
-- ^ We need to remember the name of previous temporary DLL/.so
-- libraries so we can link them (see #10322)
}
```
```haskell
--
-- | Find object files corresponding to the transitive closure of given home
-- modules and direct object files for pkg dependencies
mkObjectUsage :: PackageIfaceTable -> Plugins -> FinderCache -> HomeUnitGraph-> [Linkable] -> PkgsLoaded -> IO [Usage]
mkObjectUsage pit plugins fc hug th_links_needed th_pkgs_needed = do
...
```
where we essentially use it to generate the appropriate `Usage` objects.
Only specific fields of the `Linkable` are actually used to record the `Usage`, but a `Linkable` might hold on to a lot of memory.
Thus, we propose to introduce a new `LinkableUsage` and `LinkablePartUsage` which only retains the details necessary to create the `Usage` object in `mkObjectUsage`.
```haskell
type LinkableUsage = LinkableWith (NonEmpty LinkablePartUsage)
-- | Record usage of a 'LinkablePart'.
data LinkablePartUsage
= FileLinkablePartUsage
{ flu_file :: !FilePath
, flu_module :: !Module
, flu_linkable_objs :: !(FlatBag OsPath)
}
| ByteCodeLinkablePartUsage
{ bclu_module :: !Module
, bclu_hash :: !Fingerprint
, bclu_linkable_objs :: !(FlatBag OsPath)
}
```
This allows us to free `Linkable`s after they have been linked already.
This should reduce memory usage of long-running GHC processes, for example when it is used as a build server.
## Environment
* GHC version used: HEAD (4c58a3aecf8071bfcda6d0787652b89dec4a442f)
* GHC 9.14.1
issue