Re: [OpenMap Users] Removing Layer from MapHandler

From: Marc Benstein <MARC.D.BENSTEIN_at_saic.com>
Date: Mon, 19 Sep 2011 14:55:07 -0600

Don,
Thanks for the reply. I was wrong before _all_ layers that I add to
MapHandler or the LayerHandler fail to release the added layer object on
remove.

Something is keeping these objects around in memory. The setList(null)
call only frees the data which is the majority of memory. However, the
layer object is still sitting around somewhere and the setList(null) is
not needed if the layer itself gets freed. I will dig further. Unless
you know of the cause.

On 09/16/2011 04:51 PM, Don Dietrick wrote:
> 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 Mon Sep 19 2011 - 16:56:57 EDT

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