Welcome, Guest. Please login or register.

Author Topic: Thinking to change to the dark side (blue)  (Read 14272 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline Georg

  • Jr. Member
  • **
  • Join Date: Feb 2002
  • Posts: 90
    • Show all replies
Re: Thinking to change to the dark side (blue)
« on: April 02, 2004, 08:11:57 PM »
Quote
Protecting unused memory isnt improving stability, but is nice for debugging.


At least with standard Exec Memory Lists unused/free memory is not really completely unused. Because the unused memory chunks are linked together through MemChunk structs. So code like this:

  Forbid();
  FreeMem(mem,100);
  *mem = something;
  Permit();

can cause trouble (it's bad/stupid/ugly anyway). The Forbid() protection does lock other memory allocations, that's true, but after the FreeMem() the first 8 bytes at address might be in use for the unused-mem-chunk-linking.