Re: [OpenMap Users] Removing Layer from MapHandler

From: Don Dietrick <dfdietrick_at_gmail.com>
Date: Fri, 16 Sep 2011 18:51:20 -0400

Hi Marc,

Removing them from the MapHandler should work, although I generally
deal with the LayerHandler directly. Adding setList(null) is a good
idea for dispose(), though, I'll add that.

- Don

On Fri, Sep 16, 2011 at 6:36 PM, Marc Benstein <MARC.D.BENSTEIN_at_saic.com> wrote:
> Hi openmap-users,
>
> I am having trouble removing layers from the MapHandler. I have a few layers
> that extend OMGraphicHandlerLayer and some that extend Layer. I add them all
> to MapHandler using the add(Object) method. However, even after I remove
> them using MapHandler.remove(Object) they are still sitting around leaking
> memory. I found that if I override dispose() and call super.dispose() along
> with setList(null) the layers that extend OMGraphicHandlerLayer are garbage
> collected. Unfortunately, the classes that extend Layer do not get gc'd.
> They are very simple layers that only override
> projectionChanged(ProjectionEvent) and paintComponent(Graphics).
> Consequently, dispose() along with remove(Object) calls do not remove them
> completely.
>
> I have a suggestion to the maintainers to override dispose() in
> OMGraphicHandlerLayer and calling setList(null) along with super.dispose().
>
> How do I _really_ remove the classes that extend Layer from the MapHandler?
>
> Thanks,
>
> --
> Marc Benstein
> 505-830-6763
>
> --
> [To unsubscribe to this list send an email to "majdart_at_bbn.com"
> with the following text in the BODY of the message "unsubscribe
> openmap-users"]
>

--
[To unsubscribe to this list send an email to "majdart_at_bbn.com"
with the following text in the BODY of the message "unsubscribe openmap-users"]
Received on Fri Sep 16 2011 - 18:53:24 EDT

This archive was generated by hypermail 2.3.0 : Tue Mar 28 2017 - 23:25:10 EDT