211
GB
What is 'memory debugging' with AddressSanitizer (ASan) and what categories of bugs does it detect that valgrind also detects?
IN
एड्रेससैनिटाइज़र (एएसएएन) के साथ 'मेमोरी डिबगिंग' क्या है और यह किस श्रेणी के बग का पता लगाता है जिनका वेलग्रिंड भी पता लगाता है?
A
ASan only detects memory leaks; valgrind only detects null pointer dereferences
ASan केवल मेमोरी लीक का पता लगाता है; वालग्रिंड केवल शून्य सूचक डीरेफ़रेंस का पता लगाता है
B
Both ASan and Valgrind detect: use-after-free, heap buffer overflows, stack buffer overflows, use of uninitialised memory — ASan is 2x slower than uninstrumented code; Valgrind is 10-50x slower, making ASan more practical for CI use while Valgrind offers more detailed analysis
ASan और Valgrind दोनों पता लगाते हैं: उपयोग-बाद-मुक्त, हीप बफ़र ओवरफ़्लो, स्टैक बफ़र ओवरफ़्लो, अनइनिशियलाइज़्ड मेमोरी का उपयोग - ASan अनइंस्ट्रूमेंटेड कोड की तुलना में 2x धीमा है; वैलग्रिंड 10-50x धीमा है, जो सीआई उपयोग के लिए एएसएएन को अधिक व्यावहारिक बनाता है जबकि वैलग्रिंड अधिक विस्तृत विश्लेषण प्रदान करता है
C
ASan can only instrument programs compiled with GCC; Valgrind works with any executable
एएसएएन केवल जीसीसी के साथ संकलित कार्यक्रमों को लिख सकता है; वालग्रिंड किसी भी निष्पादन योग्य के साथ काम करता है
D
Memory debugging tools are only needed for programs over 100,000 lines of code
मेमोरी डिबगिंग टूल की आवश्यकता केवल 100,000 लाइनों से अधिक कोड वाले प्रोग्राम के लिए होती है
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English)
Use-after-free: access memory after free(). Heap overflow: write past end of malloc'd buffer. Stack overflow: write past end of stack array. Valgrind's Memcheck instruments at binary level (no recompile) with very detailed output but 10-50x overhead. ASan compiles instrumentation directly into the binary (2x overhead), making it feasible in CI pipelines. Both are essential tools for C/C++ code quality.
व्याख्या (हिन्दी)
उपयोग-बाद-मुक्त: मुफ़्त के बाद मेमोरी तक पहुंचें()। हीप ओवरफ़्लो: मॉलोक्ड बफ़र का पिछला अंत लिखें। स्टैक ओवरफ्लो: स्टैक ऐरे का पिछला अंत लिखें। वेलग्रिंड के मेमचेक उपकरण बाइनरी स्तर पर (कोई पुन: संकलन नहीं) बहुत विस्तृत आउटपुट के साथ लेकिन 10-50x ओवरहेड। एएसएएन इंस्ट्रूमेंटेशन को सीधे बाइनरी (2x ओवरहेड) में संकलित करता है, जिससे यह सीआई पाइपलाइनों में संभव हो जाता है। दोनों C/C++ कोड गुणवत्ता के लिए आवश्यक उपकरण हैं।