0

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

2
Contributors
8
Replies
9
Views
7 Years
Discussion Span
Last Post by vivekarora
Featured Replies
  • 1
    Salem 5,138   7 Years Ago

    > 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 … Read More

  • 1
    Salem 5,138   7 Years Ago

    [url]http://www.daniweb.com/forums/post982800.html#post982800[/url] What you're trying [URL="http://www.urbandictionary.com/define.php?term=turd%20polishing"]smells like this[/URL] Seriously, the only answer you'll get from most people round here in response to "I'm using Turbo C" is [B][COLOR="Red"]UPGRADE!!!!![/COLOR][/B] Read More

0

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.

1

> 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.

Votes + Comments
Well said.
0

> 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?

0

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.

0

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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.