For a project, I've created a c++ program that perform a greedy algorithm on a certain set of data. I have about 100 data set (stored in individual files). I've tested each one of these files manually and my program gave me a result each time.
Now, I wanted to "batch process" these 100 data set, because I may have more to do in a near future. So I've created another c++ application that basically loops and call my other program using the system( cmd ); command.
Now, that program works fine, but my other program, which was previously tested, now crashes during that "batch processing". Even weirder, it doesn't crash each time, or even with the same data set.
I've been at it for the past ~6 hours and I can't find what could be wrong. One of my friend suggested to me that maybe my computer calls (with system()) the other program too quickly and so it doesn't have time to free the proper memory space, but I find that hard to believe.
Thank!
EDIT:
I'm running on Windows 7 Professional using Visual Studio 2012
Related
I have problems with the terminal not outputting anything when I run my code, I provided some pictures for guidance. I'm not new to c++ but this is my first time setting up VS code. This is the ; latest version of VS Code. My goal is to have something where I can arbitrarily make code in c++ for practice, and maybe more languages down the road.
Whenever I set "stopAtEntry" to true, the machine terminal will sometimes output, but it's not consistent. And after closing the machine terminal it takes about 17 seconds for it to close. (my computer is new, so is this just a VS code thing?)
When "stopAtEntry" is false, the terminal immediately closes when the program starts.
I'm not sure if I need to adjust this file or even make it. The guy in the tutorial edited it. But it didn't help or worsen the problem. So I might remove it like it was before.
The VS code terminal works fine. It's just the machine terminal that's not working as intended. Oris just simply how compilers work. The only other ones I've tried were Bloodsheed c++ and Net Beans (for Java).
Thank you.
I couldn't find a solution to this problem. I have a very simple program to generate a PDF using JAGPDF. If i am opening the program from visual studio (same input, same parameters) it runs to the end without errors 90% of the time, but sometimes it throws an exception telling me that symbols not loaded for jagpdf-1.4.dll
If I run the executable directly, 90% it creates the PDF correctly and 10% of the time created a corrupted pdf that I cannot open. How can I solve this problem?
EDIT: I put a screenshot of the error I'm getting, it is very dificult to reproduce because the program runs normally about 90% of the time, so I have to press build several times until it crashes...
EDIT 2: Since it seems the bug is from the library, (I already send them a message reporting it but doubt they'll do something about it because last release was years ago).
I sort of solved the problem by wrapping the function around a loop using try and catch where if the first time it fails then the exception is caught and the function is tried again until it passes. I put a limit of 10 times it can run the loop before terminating it.
The thinking was that, as the events seem to be statistically independent, the loop will reduce the chance of it failing from 0.1 to 0.1^n with n the number of loops.
So now the program is crashing with a probability of 0.0000001% instead of 10%.
With this fix I am happy to report no fails for this weeks data.
Thank you all for pointing me to the direction of the error.
It sounds as if you have found a bug in the PDF library you are using. You have to file a bug report with the PDF software provider. Hopefully they can provide you support.
I've created a small parser that generates an internal representation of an expression from a string. It does compile correctly, but i just can't debug it. When i try to run it, whether it's in debug mode or not, the console pops-up and immediatly closes. In my process list, the program still appears, using 0% cpu and 100 Ko memory, and there is just no way to kill it except by restarting my PC.
The first time i tred using code blocks with the mingw compiler, and the second time i tried using visual studio 2012, but in both case i got the same problem. When trying to run it with VS it showed an error message saying something like "abort has been called".
I can provide the source code if really needed. I'm not using anything extraordinary in it, just pure standard C++ language and iosream to display results and errors in a console.
What can this be due ?
Thanks for your help :)
The actual question: what are the differences between running in Visual C++ 2010 (both release and debug mode) and standalone, excluding anything that couldn't cause the problem stated at the bottom of this post?
I have a very specific problem with my program, so I am not going to post the code. If you would like to know details of the problem to gain some understanding, I post them at the bottom. Instead, I ask: what are the differences in running in visual c++ and standalone?
I am using Visual C++ 2010, and my program is using SFML 2.0. It runs fine in studio (I am calling it studio because it is easier to type), but when run standalone on some computers only a bug will occur within the program, to do with movement being delayed but other parts not. I cannot find any links between the computer specs of the users who test it and whether they work or not.
All dlls and such are included (at least, I think they are - the program runs fine, as detailed at the bottom - maybe some users have some framework installed?). On my computer, it works all the time in studio but not standalone. On my netbook, it works, on my older computer, it doesn't. The only project settings I changed with vc++ directories and linker settings.
Problem details:
All the sounds sound slightly different and there is a possible high pitched background noise. Character movement, enemy movement and space bar delay which is supposed to be 0.5 seconds is increased to about 5 seconds but "generating pixels" (an aspect in the game with the arrow keys isn't.
I'm stressing again that it only happens on SOME COMPUTERS, mine included, but always works when run within studio. A number of people have tested the game, and some reported the problem and others different.
[NOT THE MAIN POINT OF THE QUESTION BUT HERE IS AN EXTRA BIT: If you are so willing to help me that you wish to look through the entire source code, it's here: http://dl.dropbox.com/u/53835113/EVERYTHING.zip [note: ignore the massive amount of bugs and memory leaks other than the problem described :P]]
EDIT: THE POINT ISN'T THAT I WANT MY PROGRAM DEBUGGED! That is an optional extra. The question: what are the differences in running in visual c++ and standalone?
More edits: Found that the problem is due to the frame time not being correct. Not sure if this provides some insight.
Thanks to anyone who tries to help me!
GetFrameTime() in SFML was removed in a recent version because it returns the time since last frame rather than the time since last update. As a result, the it may return 0.
I'm using Visual Studio 2010 to write and debug a small program. The problem is, whenever I start the application through Visual Studio 2010 the process of my application produces page-faults in the range of 100000 per second and that slows down the program by factor 10 or more. When I start the generated executable from the file system no page-faults are generated after the start-up is complete. That happens with the debug and the (all optimizations allowed) release build. No exceptions are getting thrown.
The program itself is compiled around 200kib and when executed holds around 10mib of data with over 4gib of memory available. There are only the main thread and the thread of the logging framework running. The data is loaded once at the start and after that only the results are stored in newly allocated memory and written to the log at the end.
There does not seem to be a lot of disk activity and the Windows Resource Monitor indicates no hard faults, while the Task Manager shows ever increasing numbers. I know that some performance loss is to be expected for using an IDE, but this seems a little bit excessive. Any advice?
Edit:
Note: I was able to get the count down to about half by cutting down on (de-)allocating new memory.
Process Explorer says:
It seems the debugger is at fault. If I do not attach it, it behaves as expected. Although I'm still wondering why it would provoke such a high amount of page faults, that it slows down all builds considerably.
Page faults are normal. It's part of the process of allocating memory. This is nothing to worry about.