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 / 2722
2721  |  2723
Subject: 
Re: detecting memory leaks
Newsgroups: 
lugnet.robotics.rcx.legos
Date: 
Fri, 12 Jul 2002 21:51:42 GMT
Viewed: 
2069 times
  
In lugnet.robotics.rcx.legos, Joseph Woolley writes:
If anyone is interested, I will post the mm_defrag() code.  If it is useful,
I suggest it be included in a future release of legOS.

Please, post.

p.s. The kernel could delay defragmenting memory until it hits a threshold.
Or even do partial defragmentation just prior to running the idle task.
This could equate to a performance boost for most programs.  Anyone
agree/disagree?

I'm guessing you defrag using mm_try_join()?  malloc() uses this to defrag
the beginning of the pool until it finds a big enough block (which can then
be split again if its too big);   Defragging during idle would save this
overhead on every malloc if malloc is rewired to only mm_try_join() *after*
checking for a big enough block (and failing to get one).

Another thought... defrag is meaningless if no malloc() or free() has
occurred since last defrag (calloc() calls malloc() internally)... might be
worth having a flag in mm.c that mm_defrag() clears and malloc/free set.
Not only do extraneous calls to mm_defrag() cost less by checking the flag
and exiting, you can auto-defrag with a thread of PRIO_MIN that sleeps until
the flag is set, defrags, repeats.  No need to insert code before the idle.

-Jason



Message has 1 Reply:
  Re: detecting memory leaks
 
Jason, Excellent points! I like where this is going. "Jason Clark" wrote <snip> (...) See below. (...) then (...) Yes, it uses mm_try_join() --- here it is: //! defragment free blocks /*! use mm_try_join on each free block of memory */ void (...) (22 years ago, 12-Jul-02, to lugnet.robotics.rcx.legos)

Message is in Reply To:
  detecting memory leaks
 
In the thread "anyone know how to check free space on RCX?" the issue of checking for memory leaks was raised. I wanted to mention that I have some code that may help in that area. I wrote a function for the memory manager called mm_defrag() It (...) (22 years ago, 12-Jul-02, to lugnet.robotics.rcx.legos)

5 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