Group: comp.lang.c++
From: Roedy Green
Date: Friday, April 11, 2008 5:56 PM
Subject: Re: Do you use a garbage collector (java vs c++ difference in "new")

On Thu, 10 Apr 2008 22:57:44 -0500, Razii
wrote, quoted or indirectly quoted
someone who said :

>
>I am not sure what you mean by that ... can you post the code?

You can download the source of the JVM if you sign some sort of
agreement. That may be waived now.

All Java "new" has to do is something like this in assembler:

addressOfNewObject = nextFreeSlot;

nextFreeSlot += sizeOfObject;

if ( nextFreeSlot > limit ) { garbageCollect(); }

fill( addressOfNewObject, sizeOfObject, 0 );
--

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com

Safety Articles | Usenet Groups | Usenet News | Bluegrass