Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fixed base address in MSVC2015

I am attempting to debug a memory leak within my application. The leaked object is somewhat difficult to identify (before destroying the heap), and there are many similar objects created. If it were to have the same address each session, it would make it considerably easier. As such, I'm trying to disable ASLR using /FIXED and /DYNAMICBASE:NO in the linker properties of my executable.

However, this doesn't seem to achieve the desired result, the address is still different each time. Additionally, even the addresses for argv in main are different each session. Are there some additional parameters I need to set, or am I somehow misunderstanding the purpose of these flags?

like image 660
MuertoExcobito Avatar asked Nov 17 '25 11:11

MuertoExcobito


1 Answers

You're looking at data addresses; ASLR is primarily for code. It determines where the EXE and DLL code segments are loaded.

You can override operator new to control memory allocations, and use VirtualAlloc with a defined base address to make allocations more deterministic (still could have multi-threaded race conditions though). Alternatively, use the MSVC default heap debugging facilities to identify a block by its sequence number instead of its address.

like image 84
MSalters Avatar answered Nov 19 '25 02:11

MSalters



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!