Ebay Interview Question for Software Developers


Country: United States




Comment hidden because of low score. Click to expand.
-1
of 1 vote

Have two objects refer to each other, and nothing else referring to either of them.

That's a leak.


Ping me for opportunities.

- RecruitingForSandvineCanada June 07, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
1
of 1 vote

False. JVM garbage collector will collect circular references, unless they're reachable from the top.

Here's an example of a memory leak. Suppose you have a static field that holds an observer, whose purpose is to notify anyone interested whenever one of the objects it observes has changed. Since it's a static field, anything it references is reachable from the top and will never be collected. Suppose you add an object to the observer, so that anyone interested will be notified while you're working with it. Let's say that when you're done with it, you forget to remove it from the observer. It will never be modified again or touched by anyone else, but it is still reachable from the top and won't be collected. That's a JVM memory leak.

- Vojislav Stojkovic June 08, 2015 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

False. JVM garbage collector will collect circular references, unless they're reachable from the top.

Here's an example of a memory leak. Suppose you have a static field that holds an observer, whose purpose is to notify anyone interested whenever one of the objects it observes has changed. Since it's a static field, anything it references is reachable from the top and will never be collected. Suppose you add an object to the observer, so that anyone interested will be notified while you're working with it. When you're done with it and you're sure it won't be modified again, you should remove it from the observer. If you don't, it will forever be reachable from the top and will never be collected. That's a memory leak.

- Vojislav Stojković June 08, 2015 | Flag
Comment hidden because of low score. Click to expand.
1
of 1 vote

False. JVM garbage collector will collect circular references, unless they're reachable from the top.

Here's an example of a memory leak. Suppose you have a static field that holds an observer, whose purpose is to notify anyone interested whenever one of the objects it observes has changed. Since it's a static field, anything it references is reachable from the top and will never be collected. Suppose you add an object to the observer, so that anyone interested will be notified while you're working with it. When you're done with it and you're sure it won't be modified again, you should remove it from the observer. If you don't, it will forever be reachable from the top and will never be collected. That's a memory leak.

- Vojislav Stojkovic June 08, 2015 | Flag


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