On Fri, 2025-06-20 at 15:04 -0400, Antoni Boucher wrote:
> Hi.
> In rustc_codegen_gcc, we rely on recording::memento::get_debug_string
> even though this function should only be used for debugging (because 
> there are no ways for now to compare rvalues, but this is another, 
> bigger story) and we faced huge memory usage (+100 GB) because 
> recording::memento::get_debug_string create memento strings, which
> means 
> they will only be freed at the end of the compilation process.
> 
> Would it be OK to change this so that the responsibility of freeing
> the 
> strings is moved to the caller of gcc_jit_object_get_debug_string?
> That might require to remove the caching that is done in 
> recording::memento::get_debug_string.
> 
> What are your thoughts on this?

I don't like this idea, since it would change the meaning of the API,
creating a memory leak in any existing code that uses
gcc_jit_object_get_debug_string.

I suppose we could add a new entrypoint that creates a client-owned
debug string, but it sounds like what you really want is a way to
compare rvalues.  What sort of comparison do you need on rvalues, and
if we provided it, would it solve your memory issues?

Hope this is constructive
Dave

Reply via email to