Adobe Interview Question for Software Engineer / Developers


Country: India




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

in java you can do that,

Runtime runtime = Runtime.getRuntime () ;

At the starting of your program:
Do,

long maxMemory = runtime.maxMemory();
long allocatedMemory = runtime.totalMemory();
long freeMemory = runtime.freeMemory();

And when you finish your program just check the same! And compare!

- Psycho September 25, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

try {
HashMap map = new HashMap();
while(true){
map.put(RandomNumber(),RandonMumber());
}

}catch(OutOfMemoryException e){
s.op( " MemoryIsFull" )

}

HashMap h = new HashMap();
h.put("hi","hello");



/* since there was no more memory... and now im able to add a new value into it, it means the memory is freed and im able to use the memory, In java Garbage collector does this, in C,/c++ you do it..... just hte difference is, allocate some high value tll it give outofmemory, then free and allocate memory again */

- lohith May 04, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

I don't think this is what the question asks for.

- Anonymous May 04, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

Can someone explains question ?

- siva.sai.2020 May 05, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

I think the question says to check whether the memory given to the program is returned at the end to the OS. In other words, the memory available to the program at the beginning should be equal to the memory available at the end. There should be no memory leakages. The program should check this. It can be done by repeatedly allocating memory, until an out of memory error is received - keeping track of no. of bytes allocated. now, free the memory and allow program to proceed. At the end of the program, the exact no. of bytes that were allocated (at the start) should be available

- Vandana Podddar May 07, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

I think the interviewer here just wants you to overload you new & delete and also provide some query interface which tells at any point of time amount of memory used by the program using new. The stack shall always get clear when the program stops so that is not concerned. Only dynamic allocation was being tested by this.

- Ashutosh May 22, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

I think the interviewer here just wants you to overload you new & delete and also provide some query interface which tells at any point of time amount of memory used by the program using new. The stack shall always get clear when the program stops so that is not concerned. Only dynamic allocation was being tested by this.

- Ashutosh May 22, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

I think the interviewer here just wants you to overload you new & delete and also provide some query interface which tells at any point of time amount of memory used by the program using new. The stack shall always get clear when the program stops so that is not concerned. Only dynamic allocation was being tested by this.

- Ashutosh May 22, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

i think in this what we can do is we can allocate some memory for variable in class inside constructor .. and then we can print the sizeof memory allocated .... in main we can delete on the same object pointing to the class ... in the destructor code we can again print the sizeof memory getting deleted ..... both should be same ...

- Nishant June 30, 2012 | 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