Re: Modifying malloc( ) implementation, without changing malloc( ) source code
Hello,
Why don’t you override the global new operator?
Re: Modifying malloc( ) implementation, without changing malloc( ) source code
In the other thread he explained that he's doing this in C. My understanding is that he needs the system's heap manager to allocate a specific address range.
Re: Modifying malloc( ) implementation, without changing malloc( ) source code
Then, why not use #define?
Code:
#include <stdlib.h>
void* MyAlloc(size_t)
{
void* p;
// ...
return p;
}
#define malloc(s) MyAlloc(s)
int main()
{
void* p = malloc( 1 ); // MyAlloc will be called instead of stdlib malloc
return 0;
}
Re: Modifying malloc( ) implementation, without changing malloc( ) source code
It's the
that we are having a small problem with.
:)
Re: Modifying malloc( ) implementation, without changing malloc( ) source code
As I posted in the other thread...
Code:
sometype *ptr = 0x040000;
If the address is sized, and no other resource is going to try to use it. Not enough information posted (in either thread) to know....
Re: Modifying malloc( ) implementation, without changing malloc( ) source code
Quote:
Originally Posted by TheCPUWizard
Not enough information posted (in either thread) to know....
Yeah, I agree, we don't even know if he is running inside Windows' virtual address space.
Re: Modifying malloc( ) implementation, without changing malloc( ) source code
Quote:
Originally Posted by Zaccheus
It's the
that we are having a small problem with.
:)
So... he needs a memory manager to manage the memory pool?... And this new manager must work better than the original one? :eek:
Re: Modifying malloc( ) implementation, without changing malloc( ) source code
I think he wants to allocate memory at a specific address, which is why I suggested VirtualAlloc, but it's really not very clear whether that function is what is needed.