Win a copy of Getting started with Java on the Raspberry Pi this week in the Raspberry Pi forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
Sheriffs:
  • Rob Spoor
  • Devaka Cooray
  • Liutauras Vilda
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Piet Souris

Boone's question

 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi, everybody:
here is from http://www.geocities.com/SiliconValley/Orchard/9362/java/javacert/newboone40-70.html
Question 65: Which statements about garbage
collection are true?
Select all valid answers.
a. You can directly free the memory allocated by
an object.
b. You can directly run the garbage collector
whenever you want to.
c. The garbage collector informs your object
when it is about to be garbage collected.
d. The garbage collector reclaims an object?s
memory as soon as it becomes a candidate for
garbage collection.
e. The garbage collector runs in low-memory
situations.
the answer is b,c,e.
but I think b is not right, cna we run the garbage collector
directly even use gc()?
and I am clear about c , what does it mean by informs?
can anyone explain this/
Thanks.
mick
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think it is badly worded. You can RUN the gc() at any time,
i.e. System.gc() but that doesn't ensure that anything will actually be garbage collected.
 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi !
I agree with Mick.
b is wrong.
calling System.gc() only "suggests" that the JVM expends effort toward recycling unused objects. Some other thread might prevent the garbage collector from running. (from RHE)
kodali
 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No but by "running" calling the gc then you are suggesting that items are garbage collected. ANd you can call the gc whenever you want
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Tacha Arnull:
No but by "running" calling the gc then you are suggesting that items are garbage collected. ANd you can call the gc whenever you want


so u can RUN the garbage collector means u can call gc(),
but the garbage collector deos not has to do garbage collect,
is that what the question mean?
thanks
Mick
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Mick:
hi, everybody:
here is from http://www.geocities.com/SiliconValley/Orchard/9362/java/javacert/newboone40-70.html
Question 65: Which statements about garbage
collection are true?
Select all valid answers.
a. You can directly free the memory allocated by
an object.
b. You can directly run the garbage collector
whenever you want to.
c. The garbage collector informs your object
when it is about to be garbage collected.
d. The garbage collector reclaims an object?s
memory as soon as it becomes a candidate for
garbage collection.
e. The garbage collector runs in low-memory
situations.
the answer is b,c,e.
but I think b is not right, cna we run the garbage collector
directly even use gc()?
and I am clear about c , what does it mean by informs?
can anyone explain this/
Thanks.
mick


sorry I mean I am not clear about c
 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
java uses mark and sweep algol for gc ...
i think inform is used in same context ....
manal ...
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Mick:
hi, everybody:
here is from http://www.geocities.com/SiliconValley/Orchard/9362/java/javacert/newboone40-70.html
Question 65: Which statements about garbage
collection are true?
Select all valid answers.
a. You can directly free the memory allocated by
an object.
b. You can directly run the garbage collector
whenever you want to.
c. The garbage collector informs your object
when it is about to be garbage collected.
d. The garbage collector reclaims an object?s
memory as soon as it becomes a candidate for
garbage collection.
e. The garbage collector runs in low-memory
situations.
the answer is b,c,e.
but I think b is not right, cna we run the garbage collector
directly even use gc()?
and I am clear about c , what does it mean by informs?
can anyone explain this/
Thanks.
mick


sorry I mean I am not clear about c
 
If you like strawberry rhubarb pie, try blueberry rhubarb (bluebarb) pie. And try this tiny ad:
Low Tech Laboratory
https://www.kickstarter.com/projects/paulwheaton/low-tech-0
reply
    Bookmark Topic Watch Topic
  • New Topic