On Fri, Oct 28, 2011 at 8:38 AM, DRAM Ninjas <[email protected]> wrote:

> Greetings,
>
> We've been memory leak hunting recently and I'm not sure if this is an
> actual leak, but I think it's something to keep in mind
>
> In particular I'm referring to the stringbuf that holds the history for a
> memory request. The way this currently works is that both
> MemoryRequest::init() functions check if there's a history pointer -- and if
> there is, they delete it.
>
> Now, I haven't gone through and checked all the code paths, but this
> requires all callers to do get_free_request() followed by init(). Now, you
> could imagine some code failing to call init(), maybe by like setting the
> fields manually directly or by calling reset() -- none of these alternate
> methods will free the memory allocated for the history buffer. I've been too
> lazy to check all these code paths, but I'm running the gperf heap checker
> on it now to double check.
>
> Now, I think the way it's done this way is to preserve the history buffer
> for free requests in case something goes wrong, but I think there has to be
> a better way to do this. Perhaps implementing:
>
> get_free_request(MemoryRequest *m); // get a free request and call init(m)
> to populate it with data
> and
> get_free_request(); // get a free request and call init() for the user to
> get a blank one
>

I agree with your suggestions.  Its better to have code that does cleanup
internally.
I'll keep this in a TODO list for next release.

Thanks,
Avadh


>
>
Anyways, I thought I'd point it out even though it's not a big deal.
>
>
>
> _______________________________________________
> http://www.marss86.org
> Marss86-Devel mailing list
> [email protected]
> https://www.cs.binghamton.edu/mailman/listinfo/marss86-devel
>
>
_______________________________________________
http://www.marss86.org
Marss86-Devel mailing list
[email protected]
https://www.cs.binghamton.edu/mailman/listinfo/marss86-devel

Reply via email to