To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.rcx.legosOpen lugnet.robotics.rcx.legos in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / RCX / legOS / 2699
2698  |  2700
Subject: 
Re: anyone know how to check free space on RCX?
Newsgroups: 
lugnet.robotics.rcx.legos
Date: 
Wed, 10 Jul 2002 04:18:08 GMT
Viewed: 
2271 times
  
kenneth,

I believe the code you are looking for is used in program.c (for LegOS
v0.2.6)  When you press the View button (with no program running) LegOS will
show you "FREE", press again, you will get the most significant portion of
the free memory size (often 9999) and then press view again, you will get
the least significant portion of the free memory size.

The code is as follows:
lcd_int(mm_free_mem());
cputw(mm_free_mem());

Notice also, that you could store the mm_free_mem() value then check it
again later in the program.  If the values are different, it could mean a
memory leak... OR it could simply mean that there are more (likely smaller)
memory chunks in the pool.

See, the memory manager allocates a header for each memory chunk once
allocated.  It will only recombine chunks at specific times (which would
elliminate the need for the headers of those chunks which are recombined).

IOW, you can't expect the mm_free_mem() to return the same value after you
allocate a series of memory blocks, then deallocate them.  The blocks may
not be recombined yet, so the headers would still be allocated, taking a
small amount of space.

OK, OK, sorry for the long winded explaination.  Just wanted to pass along
what I learned.

// Joe


"kenneth johansen" <kennethj@stud.cs.uit.no> wrote in message
news:3D2B1A71.E5D9CCA5@stud.cs.uit.no...
hi all...after a while my  RCX hangs and i think i might have a memory
leak somewhere.
anyone have, or know of, a function which i can use to check the
available memory while my
program is running ?

regards
kenneth johansen
kennethj@stud.cs.uit.no




Message has 1 Reply:
  Re: anyone know how to check free space on RCX?
 
(...) v0.2.6) When you press the View button (with no program running) LegOS will (...) Joseph, what do you mean by most significant / least significant? I'm under the impression that those two calls just display the same value, in decimal first and (...) (22 years ago, 11-Jul-02, to lugnet.robotics.rcx.legos)

Message is in Reply To:
  anyone know how to check free space on RCX?
 
hi all...after a while my RCX hangs and i think i might have a memory leak somewhere. anyone have, or know of, a function which i can use to check the available memory while my program is running ? regards kenneth johansen kennethj@stud.cs.uit.no (22 years ago, 9-Jul-02, to lugnet.robotics.rcx.legos)

13 Messages in This Thread:



Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact

This Message and its Replies on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR