Skip to content

Commit

Permalink
#1506 Reduces quantity of messages and events retained per channel to…
Browse files Browse the repository at this point in the history
… reduce overall memory consumption
  • Loading branch information
Dennis Sheirer committed Mar 25, 2023
1 parent 93c0d9c commit c29da1a
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 24 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2022 Dennis Sheirer
* Copyright (C) 2014-2023 Dennis Sheirer
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -51,7 +51,7 @@ public class DecodeEventModel extends AbstractTableModel implements Listener<IDe
public static final int COLUMN_FREQUENCY = 8;
public static final int COLUMN_DETAILS = 9;

protected int mMaxMessages = 500;
protected int mMaxEvents = 50;

protected List<IDecodeEvent> mEvents = new ArrayList<>();
protected FilterSet<IDecodeEvent> mEventFilterSet = new DecodeEventFilterSet();
Expand Down Expand Up @@ -130,12 +130,12 @@ public void reset()

public int getMaxMessageCount()
{
return mMaxMessages;
return mMaxEvents;
}

public void setMaxMessageCount(int count)
{
mMaxMessages = count;
mMaxEvents = count;
}

/**
Expand Down Expand Up @@ -167,7 +167,7 @@ public void receive(final IDecodeEvent event)

private void prune()
{
while(mEvents.size() > mMaxMessages)
while(mEvents.size() > mMaxEvents)
{
int index = mEvents.size() - 1;
mEvents.remove(index);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,20 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2023 Dennis Sheirer
*
* * ******************************************************************************
* * Copyright (C) 2014-2019 Dennis Sheirer
* *
* * This program is free software: you can redistribute it and/or modify
* * it under the terms of the GNU General Public License as published by
* * the Free Software Foundation, either version 3 of the License, or
* * (at your option) any later version.
* *
* * This program is distributed in the hope that it will be useful,
* * but WITHOUT ANY WARRANTY; without even the implied warranty of
* * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* * GNU General Public License for more details.
* *
* * You should have received a copy of the GNU General Public License
* * along with this program. If not, see <http://www.gnu.org/licenses/>
* * *****************************************************************************
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
* ****************************************************************************
*/
package io.github.dsheirer.module.decode.event;

Expand All @@ -26,13 +23,13 @@
import io.github.dsheirer.message.IMessage;
import io.github.dsheirer.message.StuffBitsMessage;
import io.github.dsheirer.sample.Listener;

import javax.swing.table.AbstractTableModel;
import java.awt.EventQueue;
import java.text.SimpleDateFormat;
import java.util.LinkedList;
import java.util.List;

import javax.swing.table.AbstractTableModel;

public class MessageActivityModel extends AbstractTableModel implements Listener<IMessage>
{
private static final long serialVersionUID = 1L;
Expand All @@ -41,7 +38,7 @@ public class MessageActivityModel extends AbstractTableModel implements Listener
private static final int TIMESLOT = 2;
private static final int MESSAGE = 3;

protected int mMaxMessages = 500;
protected int mMaxMessages = 50;
protected LinkedList<MessageItem> mMessageItems = new LinkedList<>();
protected int[] mColumnWidths = {20, 20, 500};
protected String[] mHeaders = new String[]{"Time", "Protocol", "Timeslot", "Message"};
Expand Down

0 comments on commit c29da1a

Please sign in to comment.