[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Plotting curve with addX:Y increases program size?
From: |
Marcus G. Daniels |
Subject: |
Re: Plotting curve with addX:Y increases program size? |
Date: |
30 Sep 1999 09:37:05 -0700 |
User-agent: |
Gnus/5.070084 (Pterodactyl Gnus v0.84) Emacs/20.4 |
>>>>> "NEN" == Norberto Eiji Nawa <address@hidden> writes:
NEN> The strange thing is that the program size increases steadily,
NEN> eating up all the memory after a while. I am aware that running
NEN> in graphics mode inherently incurs in some memory increase, but
NEN> this seems to be a different thing.
As long as you deposit more points on the graph, they will take up
some space. Consider the change below to your test program.
1) Note how without the "#if 1" clause the graph (and thus memory)
becomes more and more clogged. The same thing was happening
before, you just couldn't see it.
2) Note how the "#if 1" clause periodically resets the graph. In this
configuration, memory use will be bounded.
diff -c -r test/ObserverSwarm.m test-new/ObserverSwarm.m
*** test/ObserverSwarm.m Thu Sep 30 00:37:43 1999
--- test-new/ObserverSwarm.m Thu Sep 30 10:32:53 1999
***************
*** 2,7 ****
--- 2,8 ----
#import "ObserverSwarm.h"
#import <simtoolsgui.h>
+ #import <misc.h>
@implementation ObserverSwarm
***************
*** 75,84 ****
int i, ids[NUM_AGENTS];
[modelSwarm getIDs: ids];
for (i=0; i < NUM_AGENTS; i++)
! [curve addX: (double) ids[i] Y: (double) ids[i]];
return self;
}
--- 76,90 ----
int i, ids[NUM_AGENTS];
+ #if 1
+ if ((getCurrentTime () % 10) == 0)
+ [curve resetData];
+ #endif
+
[modelSwarm getIDs: ids];
for (i=0; i < NUM_AGENTS; i++)
! [curve addX: (1.0 + sin (2.0 * M_PI * (double) ids[i] / NUM_AGENTS)) *
getCurrentTime () Y: (double) ids[i] + getCurrentTime ()];
return self;
}
==================================
Swarm-Support is for discussion of the technical details of the day
to day usage of Swarm. For list administration needs (esp.
[un]subscribing), please send a message to <address@hidden>
with "help" in the body of the message.