RSA Interview Question for Software Engineer / Developers






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

1. Memory allocated by a dll is in the user process space, so if the user releases the memory using the corresponding operator i.e. new/delete, malloc/free. But if they are mixed then behavior would be to be best said undefined. It would be better if dll provides a function to release/dispose off the allocated memory.

2. In my experience if debug works fine but release crashes, then there is some memory related issue would code. We might be overwriting beyond array limits or accessing an uninitialized variable or may be we are writing to memory after its been freed. Debug version code is much more prodigal in this matter, it allocates access memory, so such matter are caught in release versions but go unnoticed in debug.

- Samit Sasan May 13, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

1) It depends on how the DLL was built (and it should be documented). If it is built to use the shared C runtime (the msvcrt.dll, if you are using a Microsoft compiler), and so is your app, then it is okay to delete / free. But otherwise (DLL uses static runtime) you will very likely be getting a crash because the free or delete call in the app attempts to release memory off a different heap that the one where it was allocated from.

It is a better design to have the DLL provide factory methods, and for the classes in that DLL to have a virtual Release method (it is crucial for the method to be virtual).

2) There may be an uninitialized memory bug in the DLL. In debug mode you tend to get everything zeroed out by the runtime. Or maybe the application releases the DLL (by calling FreeLibrary) but keeps referencing objects or functions in the DLL (in debug mode that memory may not be reused right away). There may be some assert(...) side effects, or the memory layout of some class is not the same in debug versus release.

- cristi.vlasceanu May 24, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

for 2) my impression is the compiler won't do some transformation/optimization in the debug version but will aggressively optimize for the release version. Could it be some optimization messed with the code.

- Ryan Zhang August 16, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

for 2) it must be some assert which are generally enabled with debug mode and disabled with launch version. so this might be creating the problem with the launch version.

- Anonymous September 24, 2009 | 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