2020-05-08
Memory Leak Issue
- The direct cause of the memory leak is that a wild pointer was
new’d but neverdelete’d. - After updating the current position, MapKit called
prepareGuidanceDatato find the guidance data closest to the current position. prepareGuidanceDatainvokedNavInfoProviderImpl::getTrafficLightsandNavInfoProviderImpl::getCarParks.- Taking
NavInfoProviderImpl::getTrafficLightsas an example, itnews a data pointer inNaviEventOnPathat call time. - However, there is no corresponding
delete. - It was also found that
DestEventhas the same issue.
Solution: The core principle is to disallow wild pointers, so a refactoring of NaviEventProvider was decided upon.
- First, add two fields
traffic_light_eventsandcar_park_eventsinNaviInfoProvider. - In
NaviInfoGenerator, update these two fields after the route is updated. - Then, during each
getcall, filter based on the current vehicle position. - Therefore,
PathReader::getAttributesneeds to be refactored, because the previous implementation only considered the offset relative to the current vehicle, but now an offset interface relative to the Path is required.