I need to allocate in Special address. How can I force free parts of the memory to be allocated in the process ?
Reverse Engineering Stack Exchange is a question and answer site for researchers and developers who explore the principles of a system through analysis of its structure, function, and operation. It only takes a minute to sign up.Sign up to join this community
You could do that by attaching a debugger to the process and call the function from within the debugger. But, as this would invalidate all pointers from your application into that force-free'd area, your application would crash as soon as it tries to dereference one of that pointers.
The only way to make sure you can allocate a specific memory location is allocating it as soon as possible in your program, before anything else takes it away.
Please, when you post, tell us a bit more about what you want to do and why you want to do it. There's generally no good reason to allocate a specific address in virtual memory, but there might be reasons to have a map for a specific physical address if there's hardware at that address.
So i assume your question is an X-Y Problem, and your real question is "How can i allocate a chunk of virtual memory that maps to a certain physical address". But without any context, it's impossible to know how to help you.