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 / 2724
2723  |  2725
Subject: 
Re: detecting memory leaks
Newsgroups: 
lugnet.robotics.rcx.legos
Date: 
Sat, 13 Jul 2002 00:03:24 GMT
Viewed: 
1986 times
  
In case anyone attempts to use the mm_defrag() posted previously... you will
need the following update to mm_try_join()

//! check for free blocks after this one and join them if possible
/* \param ptr pointer to size field of current block
   \return size of block
*/
size_t mm_try_join(size_t *ptr) {
size_t *next = ptr + *ptr + 1;
size_t increase = 0;

while(*next == MM_FREE && next>=&mm_start) {
  increase += *(next+1);
    increase += MM_HEADER_SIZE;
  next     = next_block(next);
}

return (*ptr) += increase;
}


//////
Notice the "&& next>=&mm_start"  for the while loop compare.  This will keep
mm_try_join() from attempting to join past the end of memory 8-)
//////


<snip>
That reminds me, there was a bug in mm.c concerning mm_try_join() • attempting
to join the last block of memory.  I will try to find that solution as • well
(so it can be included)





Message has 1 Reply:
  Re: detecting memory leaks
 
I've been experimenting with memory leak detection in the wake of recent discussions, and have some additional thoughts, including a potential kernel patch issue. This msg is a bit long, appologies. The proposed method of checking for memory leaks (...) (22 years ago, 16-Jul-02, to lugnet.robotics.rcx.legos)

Message is in Reply To:
  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)

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