LCMCore.jl icon indicating copy to clipboard operation
LCMCore.jl copied to clipboard

Memory leak in event handling of readlog.jl

Open venabled opened this issue 5 years ago • 3 comments

Right now there's no call to liblcm implementation of lcm_eventlog_free_event .

I've currently manually implemented it as:

function lcm_event_destroy(event::Ptr{LCMCore.lcm_eventlog_event_t})
    ccall(
    (:lcm_eventlog_free_event, LCMCore.liblcm),
    Cvoid,
    (Ptr{LCMCore.lcm_eventlog_event_t}, ),
    event
    )
end

But otherwise, when iterating event by event through a log file, the allocated memory is never cleared.

venabled avatar Mar 08 '19 20:03 venabled

Hi @venabled , thanks for posting. When do you suggest the calling the event_destroy function -- after the user has finished in the callback function?

dehann avatar May 05 '19 01:05 dehann

copied the new function in here (Thanks!) e30e44b

dehann avatar May 05 '19 01:05 dehann

I was using it mostly in Log-file reading, so didn't have a "callback" per se, but I think that would be a good default place to have it.

venabled avatar May 05 '19 01:05 venabled