Re: Thoughts on memory freeing



On 29 Jul, 16:36, "S James S Stapleton" <stapleton...@xxxxxxx> wrote:
"santosh" <santosh....@xxxxxxxxx> wrote in message

news:g6nd3o$omb$1@xxxxxxxxxxxxxxxxxxxxxxxxxxxx



S James S Stapleton wrote:

In languages, you end up having 'garbage collecting' methods for
freeing memory, and the other kind (I don't know the term off the top
of my head, but it's seen in C/C++ and done by directly calling the
memory deallocation function).

One term you can use is manual memory management, as opposed to Garbage
Collection whose whole purpose is to automate the task of deallocation.

There's arguments as to which is better for a program, and a lot of
what I've seen points to the GC methods.

If your language supports GC and you can accept some of it's
shortcomings, then GC certainly frees you from what would otherwise be
tedious accounting and not directly related to the problem that the
program tries to solve.

If you are using a language
where GC is nontrivial, would it be advantage to have a memory
deallocation thread? By that I mean, rather than directly deallocate
(i.e. a free call), call something which will put the memory free'ing
on another thread (either by placing it on a to-be-deleted queue -
which would have delays due to locks/mutexes, or by running each
deallocation in it's own thread - which would have the thread creation
overhead).

You would be reimplementing a lot of the functionality of your
language's "free" routine by doing this, unless of course your language
is primitive enough to not provide them in the first place.

Oh, I was thinking of just calling 'free' in it's own thread as the main
implementation idea. I take it the system's free implementation probably
already does this?

You need to track what needs freeing. Free() is uncodinitional. Some
implemetnations crash if
you free the same memeory twice, too.
.



Relevant Pages

  • Re: Thoughts on memory freeing
    ... but it's seen in C/C++ and done by directly calling the ... memory deallocation function). ... Collection whose whole purpose is to automate the task of deallocation. ... If your language supports GC and you can accept some of it's ...
    (comp.programming)
  • Re: Simple question, err... I think
    ... One assumption is then that client code should leak memory. ... Given that there's no deallocation for these RB trees, ... a pointer to an invalid tree and it might segfault. ...
    (comp.programming)
  • Re: Clearing Page Deallocation Table on 997-400
    ... Clearing Page Deallocation Table on 997-400 ... The PDT is a little different than the memory ... PDT, if it does, you can ignore the rest of this message. ... To join/leave the list, search archives, change list settings, * ...
    (comp.sys.hp.mpe)
  • Re: Clearing Page Deallocation Table on 997-400
    ... Clearing Page Deallocation Table on 997-400 ... The PDT is a little different than the memory ... PDT, if it does, you can ignore the rest of this message. ...
    (comp.sys.hp.mpe)
  • Re: Garbage Collector!!!! is it required
    ... No the garbage collector is certainly less overhead than manual heap ... deallocation until after that loop is complete, ... of unnecessary memory management during the loop itself. ...
    (microsoft.public.dotnet.languages.csharp)