a 20-line random walk [heap corrupted]
Re: a 20-line random walk
edit:
Yes, you were right. rand() is not random. Your random generator works a LOT better! It's actually random. You start several statistically indipendent random walks and you obtain a slow decrease. You look at a single random walk and it will fluctuate about zero with fluctuations that are consistent with the distance traveled. Perfect. Now I can carry on working thanks to you guys.
Yes, you were right. rand() is not random. Your random generator works a LOT better! It's actually random. You start several statistically indipendent random walks and you obtain a slow decrease. You look at a single random walk and it will fluctuate about zero with fluctuations that are consistent with the distance traveled. Perfect. Now I can carry on working thanks to you guys.
- Attachments
-
- lux random.jpg
- (30.44 KiB) Not downloaded yet
Re: a 20-line random walk [heap corrupted]
Perfect..
I think that I have just ruined my PC forever. I made a memory leak and forgot about it. Now everytime I run my program, I get weird errors. The code pauses and I get debug assertion saying that the code has triggered a break point.
Then when I go and look at the problem I see this
No idea what it means. Does anyone know?
I think that I have just ruined my PC forever. I made a memory leak and forgot about it. Now everytime I run my program, I get weird errors. The code pauses and I get debug assertion saying that the code has triggered a break point.
Code: Select all
Windows has triggered a breakpoint in KMC.exe.
This may be due to a corruption of the heap, which indicates a bug in KMC.exe or any of the DLLs it has loaded.
This may also be due to the user pressing F12 while KMC.exe has focus.
The output window may have more diagnostic information.
Code: Select all
extern "C" _CRTIMP int __cdecl _CrtIsValidHeapPointer(
const void * pUserData
)
{
if (!pUserData)
return FALSE;
if (!_CrtIsValidPointer(pHdr(pUserData), sizeof(_CrtMemBlockHeader), FALSE))
return FALSE;
return HeapValidate( _crtheap, 0, pHdr(pUserData) );
}
-
- Posts: 4373
- Joined: February 28th, 2013, 3:23 am
- Location: Oklahoma, United States
Re: a 20-line random walk [heap corrupted]
The output window may have more diagnostic information.
Have you checked here ^
Have you checked here ^
If you think paging some data from disk into RAM is slow, try paging it into a simian cerebrum over a pair of optical nerves. - gameprogrammingpatterns.com
Re: a 20-line random walk [heap corrupted]
mmm.. the thing is.. what is the output window?
the console window itself is pitch black and the VS window is pointing to those lines of code that I posted. Not sure where to look at.
ALSO, I just run the code in another computer and it runs perfectly. Got my results and I am happy and everything. Just, I don't know how bad I screwed things up when I was not releasing and deleting my pointers. Not sure how to get that memory back on stack overflow they say it doesn't even matter because modern machines clean up everything anyway.
the console window itself is pitch black and the VS window is pointing to those lines of code that I posted. Not sure where to look at.
ALSO, I just run the code in another computer and it runs perfectly. Got my results and I am happy and everything. Just, I don't know how bad I screwed things up when I was not releasing and deleting my pointers. Not sure how to get that memory back on stack overflow they say it doesn't even matter because modern machines clean up everything anyway.
-
- Posts: 4373
- Joined: February 28th, 2013, 3:23 am
- Location: Oklahoma, United States
Re: a 20-line random walk [heap corrupted]
When you compile the program the output window is at the bottom of the VS window. Anyway it sounds like you know where it is anyway. I would run in debug mode and set a few break points you think it might be and narrow down where the error is being caused. You can also set a break point and press F10 or F11 to go line by line and wait for the error.
If you think paging some data from disk into RAM is slow, try paging it into a simian cerebrum over a pair of optical nerves. - gameprogrammingpatterns.com
Re: a 20-line random walk [heap corrupted]
OK. Thanks, I'll try that.
Is the memory that you lose while not deleting the pointers coming back after you go back to the code and delete them?
Is the memory that you lose while not deleting the pointers coming back after you go back to the code and delete them?
Re: a 20-line random walk [heap corrupted]
it returns when the app exits, can always restart pc in case lol
always available, always on, about ~10 years c/c++, java[script], win32/directx api, [x]html/css/php/some asp/sql experience. (all self taught)
Knows English, Spanish and Japanese.
[url=irc://irc.freenode.net/#pchili]irc://irc.freenode.net/#pchili[/url] [url=irc://luisr14.no-ip.org/#pchili]alt[/url] -- join up if ever want real-time help or to just chat --
Knows English, Spanish and Japanese.
[url=irc://irc.freenode.net/#pchili]irc://irc.freenode.net/#pchili[/url] [url=irc://luisr14.no-ip.org/#pchili]alt[/url] -- join up if ever want real-time help or to just chat --
-
- Posts: 4373
- Joined: February 28th, 2013, 3:23 am
- Location: Oklahoma, United States
Re: a 20-line random walk [heap corrupted]
I've always wondered about memory leaks myself. I use to use a program that you could watch the memory depleting in the task manager while the computer was running, but it's been so long that I can't remember if the memory was reclaimed when I exited or not. Pretty sure it did, but again I just can't remember. I suppose it could be tested by just allocating a couple gigs of ram and then exit the program without any deallocating and see what happens.
If you think paging some data from disk into RAM is slow, try paging it into a simian cerebrum over a pair of optical nerves. - gameprogrammingpatterns.com
Re: a 20-line random walk [heap corrupted]
If you use C# and create a "new" instance of an object, it deallocates the memory for you doesn't It. I have been exploring c# and all the examples i have seen, none calls for deallocation ... A tad off topic , but is that so ?, C# handles memory management for you ? . If so, that just makes programming lazy lol ... ohhh wait, programmers are lazy, cut'n paste, cut 'n paste ... lalala ...... hahahaha
Peace Out
Peace Out
Curiosity killed the cat, satisfaction brought him back
Re: a 20-line random walk [heap corrupted]
After using c++ for a few years, I must say that I really dislike c#. Dynamic memory allocation I find to be a joke. First off they have their "garbage collector" that automaticly frees all memory for you as it goes out of scope. Also, it moves all your memory around so an array is no longer a pointer. I feel it creates more pain than productivity if you know what your doing. One thing that c# is nice for is .net framework and built in functions or "methods" if you use c# terminology.
Computer too slow? Consider running a VM on your toaster.