Bloomberg LP Interview Question for Software Engineer / Developers






Comment hidden because of low score. Click to expand.
2
of 2 vote

Three approaches:
1. reference counting:each dynamically allocated memory is associated with a reference count, which increases when that piece of memory is references( pointers) and decreases when a reference is removed. when the reference count is 0, it can be removed.
the good thing is that it is easy to implement and doesn't disturb the heap organization. bad thing is it adds overhead to pointer operation (although it is low cost) and cannot detect circular reference.
2. mark and sweep:initially all objects in the heap are unmarked. Then when they are directly or indirectly referenced, it is marked as "in-use". Finally all allocated memory is scanned and the unmarked objects are removed. The good thing with this approach is that it solves the problem of circular references and adds no overhead to pointer operation. Bad thing is that scanning the entire heap is time consuming and hard to implement efficiently.
3. copying:organizes the free memory into active and idle spaces. In garbage collection, all in-use objects from active spaces are found and copied to the idle space and then the role of the two spaces are reversed. This can solve the fragmented heap memory problem but resulted that only half of free memory can be in use.

- MD February 28, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

http://www.devarticles.com/c/a/Cplusplus/A-Simple-Garbage-Collector-for-C-plus-plus/2/

- Rashmi February 02, 2006 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Khoa, did they ask you to write all this on the fly?

- Anon April 08, 2006 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

I didn't really write it. I just give them the algorithm and they were satisfied.

- Khoa April 09, 2006 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

They wants you to write a class or what?

- J.C. March 31, 2007 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

devarticles.com/c/a/Cplusplus/A-Simple-Garbage-Collector-for-C-plus-plus/2/
brpreiss.com/books/opus5/html/page424.html

- Anonymous February 28, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

devarticles.com/c/a/Cplusplus/A-Simple-Garbage-Collector-for-C-plus-plus/2/
brpreiss.com/books/opus5/html/page424.html

- Anonymous February 28, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

devarticles.com/c/a/Cplusplus/A-Simple-Garbage-Collector-for-C-plus-plus/2/
brpreiss.com/books/opus5/html/page424.html

- MD February 28, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

i really want to have the answer of this question in simple language how garbage collection can be implemented plzzzzzz help me anybody...

- manpreet bindra September 11, 2016 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

144523

- manpreet bindra September 11, 2016 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

144523

- manpreet bindra September 11, 2016 | Flag Reply


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More