Qualcomm Interview Question for Software Engineer / Developers






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

Malloc uses variable sized blocks in allocating memory. Using variable sized blocks has the disadvantage of leaving holes in the memory [fragmentation], which may lead to certain memory requests not being satisfied even though there is enough memory in the system. Memory defragmentation is a very costly exercise and not even general purpose machines do it automatically, let alone embedded systems. So, most embedded systems use fixed size blocks for memory allocation. This has the advantage that all the holes that are created in the system are of the same size which is that of the fixed size block. Hence there is no need for defragmentation.

- Bandicoot April 02, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
1
of 1 vote

Benefits of not using malloc in embedded:

Fixed size allocation allow memory allocation with
constant execution time (no fragmentation). The memory 
release for thousands of objects in a pool is just one 
operation, not one by one if malloc is used to allocate 
memory for each object.

Fixed size allocation can be grouped in hierarchical tree 
structures, which is suitable for special programming 
structures like loops and recursions.

Fixed-size block memory pools do not need to store 
allocation metadata for each allocation, describing 
characteristics like the size of the allocated block. 
Particularly for small allocations, this provides a 
substantial space savings.

- Ashutosh April 02, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

Thnx for the nice reply :)

- game April 02, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

thanx buddy...

- Anonymous December 27, 2012 | 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