473,952 Members | 8,641 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

SGCL - Garbage Collector for C++

SGCL is precise, parallel garbage collection library for C++ (at this time
for Windows 32/64 only). SGCL is free software published under University of
Illinois/NCSA Open Source License.

Get it at:
http://sourceforge.net/projects/sgcl/

Regards
Sebastian Nibisz

Feb 28 '08
72 3523
Sebastian Nibisz wrote:
SGCL is precise, parallel garbage collection library for C++ (at this
time for Windows 32/64 only). SGCL is free software published under
University of Illinois/NCSA Open Source License.

Get it at:
http://sourceforge.net/projects/sgcl/

Regards
Sebastian Nibisz


Sounds like interesting stuff for anyone who wants to use GC in his/her
applications.

The thread shouldn't turn out to the flame "Do we need garbage
collection"? Anyone that can afford it in his/her applications and wants
to, he/she may use it.
Feb 28 '08 #21
James Kanze wrote:
On Feb 28, 7:25 pm, Phil Endecott <spam_from_usen et_0...@chezphi l.org>
wrote:
>Sebastian Nibisz wrote:
>>>or
>>>struct node
{ boost::shared_p tr<nodenext;
};
>>{
for (int x = 0; x < 1000000; ++x)
{
n = n->next = shared_ptr<node >(new node);
}
} // <- STACK OVERFLOW
>Why?

You're kidding us, right?
James, that's pretty rude. I know this is usenet but I'd really
appreciate if if you could moderate the way you express yourself. I am
not "kidding you" when I say that I did not spot this problem, which is
why I asked "Why?". I have learnt something new and interesting this
evening. Why you had to chime in with that patronising phrase is beyond me.

Goodbye.
Feb 29 '08 #22
Sam
Sebastian Nibisz writes:
>Garbage collection is for lazy rich folks who can't be bothered to
take out their own trash.

It's funny.
It's true. If you do not have the skills and the know-how to keep track of
your own objects, and manage their lifetime, you have no business writing
mission-critical, business software.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)

iD8DBQBHx1dux9p 3GYHlUOIRAsG0AJ 9jyQycVNKccijiG xu+wtSXfYZ3pQCf YtcN
eALnun9Sn1DJK+2 aUAlLpt0=
=jUjy
-----END PGP SIGNATURE-----

Feb 29 '08 #23
Sam
Sebastian Nibisz writes:
>for (int x = 0; x < 10; ++x)
{
n = n->next = new node;
n->next = 0;
}

n=root;
while(n){
root=n;
n=n->next;
delete root;
}

Ok. What if there is a cyclical list?
Use your brain, and add two lines of code to the above fragment, making it
work for cyclical lists.

No, I'm not going to show you how to do it. I'm not sure you'll be able to
understand it.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)

iD8DBQBHx1f8x9p 3GYHlUOIRAgtHAJ 9XsfYsIvZ4pQ8W4 t4Kx6DXxkTDOwCe LBAg
JXRwFrr2SpQBU4R R0SSAWjU=
=vSvG
-----END PGP SIGNATURE-----

Feb 29 '08 #24
I am impressed by your intelligence.
Feb 29 '08 #25
Sam
Sebastian Nibisz writes:
I am impressed by your intelligence.
You should be. You can't even manage the task of quoting the message you're
replying to, so that others actually may have a hint as to what in blazes
you're yammering about.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)

iD8DBQBHx2ikx9p 3GYHlUOIRAls5AJ 9tENSCTFk2gJcMh cw6xSblXxn9PACf UcYj
MH1+Wpay/btH5+bKpq6HVG8=
=JOuP
-----END PGP SIGNATURE-----

Feb 29 '08 #26
Sebastian Nibisz wrote:
>>struct node
{
node* next;
};

node* root = new node;
node* n = root;

for (int x = 0; x < 1000000; ++x)
{
n = n->next = new node;
}

How to release memory?

It's hard to guess why you would allocate nodes that way in the first
place.

The parent must know the child.
Sorry, I meant why not use a standard container to manage the nodes'
lifetimes? The slist mentioned elsewhere on this thread was a
reasonable suggestion, if std::list is too heavy.
Feb 29 '08 #27
Alf P. Steinbach wrote:
* James Kanze:
>On Feb 28, 7:25 pm, Phil Endecott <spam_from_usen et_0...@chezphi l.org>
wrote:
>>Sebastian Nibisz wrote:
or
>>>>struct node
{ boost::shared_p tr<nodenext;
};
>>>{
for (int x = 0; x < 1000000; ++x)
{
n = n->next = shared_ptr<node >(new node);
}
} // <- STACK OVERFLOW
>>Why?

You're kidding us, right?
....
>>
It's really pretty rare that you can recurse 1000000 times
without the stack overflowing.

Huh?
I'm not sure it's obvious until you're been looking at it for a few
minutes, but given a program like the following:

#include <tr1/memory>

using std::tr1::share d_ptr;

struct node {
shared_ptr<node next;
};

int main() {
shared_ptr<node root(new node);
shared_ptr<node n(root);

for (int x = 0; x < 1000000; ++x) {
n = n->next = shared_ptr<node >(new node);
}
}

When the "root" shared_ptr goes out of scope, the first node's reference
count goes to zero. root's destructor therefore deletes the first node,
causing the destructor of root->next to be invoked. That destructor
sees the reference count of the second node become zero, and so deletes
the second node, causing root->next->next to be invoked. And so on...

A better approach, IMHO, would be to let a factory allocate the nodes,
preferably as elements of a std::list<node> . The factory's destructor
(the list's, really) can make sure the memory is freed.
Feb 29 '08 #28
On Feb 29, 1:53 am, Sam <s...@email-scan.comwrote:
Sebastian Nibisz writes:
Garbage collection is for lazy rich folks who can't be
bothered to take out their own trash.
It's funny.
It's true. If you do not have the skills and the know-how to
keep track of your own objects, and manage their lifetime, you
have no business writing mission-critical, business software.
And if you intentionally reject the use of a labor saving
device, and do something by hand which can easily be automated,
you're being professionally irresponsible.

--
James Kanze (GABI Software) email:ja******* **@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientier ter Datenverarbeitu ng
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34
Feb 29 '08 #29
On 28 Feb, 14:49, Linonut <lino...@bollso uth.nutwrote:
* Sebastian Nibisz peremptorily fired off this memo:
SGCL is precise, parallel garbage collection library for C++ (at this time
for Windows 32/64 only).

Ridiculous.
why?

<snip>

--
Nick Keighley
Feb 29 '08 #30

This thread has been closed and replies have been disabled. Please start a new discussion.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.