Hello Friends,

We have a known problem in our hands:

Allocate some memory, and get a pointer to that memory.
Now, no one stops this pointer to perform memory overrun or underrun(i.e. writing before the allocated memory).

I wish to implement 2 functions as MyMalloc() & MyFree().
When I use MyFree(), I must be atleast able to findout if any memory overrun/underrun was done.

Can you pls. help me in this?
If you need more info., pls. revert back.

Regards,
Vivek

Same answer as your other thread
http://www.daniweb.com/forums/thread221310.html

Or you could mention which OS/Compiler you're using.
For Linux, I strongly recommend valgrind for finding overruns and leaks.

Let's say I am using Turbo C compiler in Windows. So, my logic and program should be able to find it.

> Let's say I am using Turbo C compiler in Windows
Sure, why not - if you consider amputation to be a suitable first step to running a marathon.

I shouldn't worry about memory leaks in TurboC. The most it could ever allocate is 640K and that's just no threat to the integrity of your system.

commented: Well said. +14

> Let's say I am using Turbo C compiler in Windows
Sure, why not - if you consider amputation to be a suitable first step to running a marathon.

I shouldn't worry about memory leaks in TurboC. The most it could ever allocate is 640K and that's just no threat to the integrity of your system.

lol...anyways do you have a reasonable solution which i can put in my program to detect this?

http://www.daniweb.com/forums/post982800.html#post982800

What you're trying smells like this

Seriously, the only answer you'll get from most people round here in response to "I'm using Turbo C" is UPGRADE!!!!!

lol...I must share the complete details:
1) Can you help me how can i achieve this in Visual Studio?
2) And how can i achieve this using armcc?
Although, essentially my requirement is to implement it in my program so that i don't need any special services from compiler for this.

Hello Friends,

Can someone help me how to write code to identify memory overrun/underrun?
Atleast when I am freeing the memory i should be able to make out this.

Regards,
Vivek

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.