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 / 1129
1128  |  1130
Subject: 
Re: memory left
Newsgroups: 
lugnet.robotics.rcx.legos
Date: 
Wed, 7 Jun 2000 19:37:29 GMT
Viewed: 
1231 times
  
Is there a way to check how much memory is still available on the RCX?

This little program scans the memory list and prints the amount of free
memory:

Eddie C. Dost
ecd@skynet.be
--
#include <unistd.h>
#include <stdlib.h>
#include <sys/tm.h>
#include <sys/mm.h>
#include <sys/irq.h>
#include <conio.h>

extern size_t *mm_first_free;
extern size_t mm_start;

int
main(int argc, char **argv)
{
size_t size, total;
size_t *ptr;

total = 0;

ptr = mm_first_free;
while (ptr >= &mm_start) {
if (*(ptr++) == MM_FREE) {
size = *ptr << 1;
total += size;
}

ptr += (*ptr) + 1;
}

total = (total / 1024) * 100 + (total % 1024) / 10;
lcd_number(total, sign, e_2);
return 0;
}



Message is in Reply To:
  memory left
 
Is there a way to check how much memory is still available on the RCX? Torkel (24 years ago, 7-Jun-00, to lugnet.robotics.rcx.legos)

9 Messages in This Thread:


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

Custom Search

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