Welcome, Guest. Please login or register.

Author Topic: The New MorphOS Memory System  (Read 3258 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline Trev

  • Hero Member
  • *****
  • Join Date: May 2003
  • Posts: 1550
  • Country: 00
    • Show all replies
Re: The New MorphOS Memory System
« on: February 11, 2009, 02:24:58 AM »
Nice. And now we wait for negative comments from the same naysayers that thwarted Chris's efforts. ;-)

Re: legacy MEMF_REVERSE usage, if you observed that your allocations were in the upper half of memory (either physically or with respect to memory lists), wouldn't using MEMF_REVERSE have decreased allocation time by at least a factor of two, barring fragmentation?

It also seems to me that using an allocaligned-like function would have increased fragmentation with very little benefit, particularly for alignments <= 16, by unnecessarily increasng the size of the system memory lists. I'm speaking from the perspective of someone with no real knowledge of the internals of Amiga OS memory allocation, though.
 

Offline Trev

  • Hero Member
  • *****
  • Join Date: May 2003
  • Posts: 1550
  • Country: 00
    • Show all replies
Re: The New MorphOS Memory System
« Reply #1 on: February 11, 2009, 07:51:10 AM »
@Piru

Quote

The way MEMF_REVERSE flag is implemented in the First Fit algo is actually even slower than normal allocations. It always must scan all free memory blocks to find the last matching one (since they're sorted by address). Also, with TLSF the MEMF_REVERSE flag only adds complexity to the routine without adding any performance, or reducing the fragmentation.


Eek. I had assumed OS3 memory lists were doubly-linked, in which case they could be traversed in the reverse direction. D'oh! So yes, MEMF_REVERSE = mostly useless.

Quote

Allocaligned kind of functions are only used to get memory aligned to specific granularily. Often it's needed for DMA operations, getting memory aligned to PPC code/stack alignment requirements or MMU page size aligned memory areas. You indeed should not use them lightly as they increase fragmentation quite dramatically. Luckily with TLSF the fragmentation no longer is an issue.


Which is why I've been allocating size+align-1, keeping track of the original pointer, and just passing around pointer&~align without reallocating....

Anyhow, I'm always glad to see Amiga-like operating systems keeping up with the state of the art, even if I don't have the hardware to run them. :-P And I'm also glad that Chris is still maintaining TLSFMem for OS3, albeit for E3B customers. Fortunately, I have a Deneb.