Dr Memory will not run with SDL ttf (2.0.10) - sdl

Upon adding SDL_ttf (2.0.10), DrMemory refuses to work anymore. The console went from printing out the messages to outputting nothing and sending the following to stdout:
~~Dr.M~~ WARNING: unable to locate results file: can't open D:\DrMemory
\drmemory\logs/resfile.6188 (code=2). Dr. Memory failed to start the
target application, perhaps due to interference from invasive security
software. Try disabling other software or running in a virtual machine.
Is there any way around this with some command line flag for Dr Memory or will I have to forego using Dr Memory?
Note: It works perfectly fine with other SDL stuff until I add the TTF Library and add a TTF_Font *font somewhere. The code I have works fine and there is no loading errors or anything wrong with it, it's at a very primitive level and fresh/new. I just cannot get Dr Memory to work as soon as any TTF element is added to the source code.

It works with a 32-bit build, but not a 64-bit build... so I switched to using 32-bits.
Since this is not a full answer as to why. However if anyone finds it breaking for them, try 32-bit.

Related

dlib object detection always return zero results on iOS

I have been using dlib object detection successfully on mac. Now I want to use it in an iOS app. However, after spending countless hours, dlib object detector always returns zero rectangles.
ifstream fin(dataDir + "/object_detector.svm", ios::binary);
typedef dlib::scan_fhog_pyramid<dlib::pyramid_down<6> > image_scanner_type;
dlib::object_detector<image_scanner_type> detector;
dlib::deserialize(detector, fin);
vector<dlib::rectangle> dets = detector(dlibImage);
To make sure it’s not due to a different image, I am using exact same image for which detector returns 1 hit on mac. I have also printed uchar from part of the image in both mac and iOS, and it’s returning same values. So image data is exactly the same.
Probably dlib library is not built correctly for iOS. I have tried multiple approaches for this. From /example/build dir, below command was invoked.
cmake -G Xcode ..
cmake --build . --config Release
It generated dlib.xcodeproj project in dlib_build dir. I opened the project in xcode, changed architecture to iOS (armv7, arm64) and rebuild the library. This library was linked to my project. I got zero results with this approach. dlib was built in debug mode; I did not get any assertion errors.
Second approach tried was to use dlib/all/source.app in my project. I used all the proprocessing flags that are used by cmake or dlib.xcodeproj project. No errors, but still no matches.
I have compared build settings of my xcode project with examples.xcodeproj generated by cmake and it’s same. Also checked the xcode project from https://github.com/zweigraf/face-landmarking-ios, but no help.
Strange thing is detector takes couple of seconds to process and comes back with zero matches. So it’s doing something. I wish there was a debug logging that I can turn on for the detector.
I am out of ideas. Will appreciate if anyone can help. dlib is a wonderful library, I just wish it would have been easier to work with on iOS.
dlib is working fine on iOS too. Kicking myself for it, but I mixed up the detector instances. The detector on which I called below line was not used for object detection.
dlib::deserialize(detector, fin);
I was just using an empty detector instance, and it was returning 0 detections. By empty detector, I mean it was defined but deserialize method was not invoked. It would have been nice if dlib returned an error or warning, if a detector not loaded with object_detector.svm file is used for detection.
I have observed the same behavior with shape detector too. If sp.dat is not loaded, it silently reports 0 parts detected. Posting this as answer, in case someone else also makes such a silly mistake.

GLUT: Fatal Error: out of memory

I have an opengl implementation that runs fine on my desktop.
But even though i have it set up the exact same way on my laptop i get an "out of memory" error when i try to run it.
it is strange because on my desktop the application only takes up 200mb ram and i have 2gb available on the laptop
any ideas what might cause this?
btw im running the application through Visual Studio 2012 Ultimate and using the glut setup suggested in the first answer of this post: How to fix this Error: #include <gl/glut.h> "Cannot open source file gl/glut.h"
Check the encoding of your file
(http://lists.apple.com/archives/mac-opengl/2006/Jun/msg00070.html)
Ensure you're using the same runtime environment
(have you installed the same glut.dll on your laptop?)
Finally, I have a question:
What do you mean "running the application through Visual Studio"? Do you hit Ctrl+F5?
I found the solution, it is rather dumb.
I had set up "main" as "Entry Point" in "Project Preferences -> Linker -> Advanced" because it was necessary on my desktop.
I removed this so i had a blank "Entry Point" and my code runs fine ^^
posting in case someone needs this info

Strange "No such file or directory" error in cuda-gdb

I already asked this question in the nvidia forum but never got an answer link.
Every time I try to step into a kernel I get a similar error message to this:
__device_stub__Z10bitreversePj (__par0=0x110000) at
/tmp/tmpxft_00005d4b_00000000-1_bitreverse.cudafe1.stub.c:10
10 /tmp/tmpxft_00005d4b_00000000-1_bitreverse.cudafe1.stub.c: No such file or directory.
in /tmp/tmpxft_00005d4b_00000000-1_bitreverse.cudafe1.stub.c
I tried to follow the instructions of the cuda-gdb walkthrough by the error stays.
Has somebody a tip what could cause this behaviour?
The "device stub" for bitreverse(unsigned int*) (whatever that is) was compiled with debug info, and it was located in /tmp/tmpxft_00005d4b_00000000-1_bitreverse.cudafe1.stub.c (which was likely machine-generated).
The "No such file" error is telling you that that file is not (or no longer) present on your system, but this is not an error; GDB just can't show you the source.
This should not prevent you from stepping further, or from setting breakpoints in other functions and continuing.
I was able to solve this problem by using -keep flag on the nvcc compiler. This specifies that the compiler should keep all intermediate files created during the compilation, including the stub.c files created by cudafe that are needed for the debugger to step through kernel functions. Otherwise the intermediate files seem to get deleted by default at the end of the compilation and the debugger will not be able to find them. You can specify a directory for the intermediate files as well, and will need to point your debugger (cuda-gdb, nsight, etc) to this location.
I think I had such problem once, but can't really remember what was it caused with. Do you use textures in your kernel? In that case you couldn't debug it.

The SDL library I built from source crashes!

I've successfully built SDL from source using bcc 5.5.1 but any SDL test application using it crashes right away at startup. I'm looking for some help and/or guidance on how to resolve this issue.
Just to fill in some info, SDL-1.2.14 was used. The project's compiled as a dll with multithreading enabled and linked to C runtime dynamically. I've also rebuilt it with debugging info. When I step through with a debugger up to the point of crash it seems to be coming from redirect_stdout in the sdlmain. If I remove sdlmain.lib and use the source file sdl_win32_main.c directly in the SDL test project then that doesn't crash anymore. Instead it just crashes later on at SDL_Init routine.
I've already checked the calling conventions used and they all seem to match up -- everything is using cdecl. I've also checked and made sure the compiled sdl.dll and the test application was using the same dynamic c runtime instead of statically linked.
The SDL wiki under Borland section mentions to use the -b to make sure enum's are same size as int but that option is enabled by the compiler by default unless explicitly turned off. I did rebuild SDL with that compiler/linker switch just to be sure though.
When it crashes, it's always a access violation in trying to write to some address(c000005). Like for example during a typical SDL init attempt like this:
// initialize SDL video
if ( SDL_Init( SDL_INIT_VIDEO ) < 0 )
{
printf( "Unable to init SDL: %s\n", SDL_GetError() );
return 1;
}
After the call into SDL_Init(), control doesn't flow back into the test application. Instead it crashes somewhere bizarre like somewhere in ntdll.dll with something having to do with NTDLL.RtlEnterCriticalSection. When I inspect the stack trace at that point I usually get something like this:
:77982269
:0044A04C
:0043F02B
:0043F7C4
:0043EF25
SDL_CreateSemaphore(1)
SDL_CreateMutex()
SDL_CreateSemaphore(1)
SDL_CreateMutex()
SDL_CreateSemaphore(1)
SDL_CreateMutex()
SDL_CreateSemaphore(1)
SDL_CreateMutex()
SDL_CreateSemaphore(1)
SDL_CreateMutex()
SDL_CreateSemaphore(1)
SDL_CreateMutex()
SDL_CreateSemaphore(1)
//and it keeps recursing... looks like a stackover? :P
I'm not sure whatelse to try at this point as I'm pretty stumped. If anyone have any suggestions or need me to provide more info please feel free to add it to the comments.
Thanks
Alright, I finally found out what the issue was a couple days ago. The reason for the crash was because the wrong source file was compiled for the given platform.
The project file I used kept compiling SDL_sysmutex.c from threads\generic. The correct SDL_sysmutex.c to use under win32 should have been from threads\win32. I found this out when I was tracing the test programs side by side and the threading modules had different lines of code!
With this little oversight fixed the crashing problems have all but disappeared and all the test demos are running as they should :)

Exception thrown when exiting program (Ogre3d)

I am getting a weird exception when I exit the program. This has started since today morning and I am ready to pull my hair out. As soon as I exit the program, visual studio gives an exception and stops at line 731 in the file crt0dat.c (see attached screenshot)
I know this is very little to go on. I have tried several different things:
un the program without doing anything, that is, not initializing Ogre Core at all. Does not result in a crash
Run the program with everything commented out except creating Ogre root (which is related to Ogre itself and has nothing to do with my code), results in the same crash
Run the following program which is as basic as it gets, still results in the crash. The crash happens after return 0, when my program has finished running
#include "windows.h"
#include "OgreRoot.h"
/// --------------------------------------------
INT WINAPI WinMain(HINSTANCE hInst, HINSTANCE, LPSTR strCmdLine, INT)
{
Ogre::Root* lRoot = new Ogre::Root();
delete lRoot;
lRoot = NULL;
return 0;
}
/// --------------------------------------------
Since I have everything on the SVN, I ran the same project on my laptop and it worked without any problems, as well as exited without any problems. This led me to believe that somewhere along the line my visual studio got corrupted. I uninstalled Visual studio, then re-installed it, but the problem persists (When VS installs it goes all over my system. No way to contain it. Does anyone know a surefire way to completely destroy Visual Studio installation?). I am running out of ideas, short of re-installing windows. I hope someone here can be of help.
Callstack:
048b0910()
ntdll.dll!775d9901()
[Frames below may be incorrect and/or missing, no symbols loaded for ntdll.dll]
ntdll.dll!775edc30()
ntdll.dll!775edb7c()
kernel32.dll!76c67363()
> msvcr90d.dll!__crtExitProcess(int status=0) + 0x1b bytes C
msvcr90d.dll!doexit(int code=0, int quick=0, int retcaller=0) + 0x1d1 bytes C
msvcr90d.dll!exit(int code=0) + 0x12 bytes C
OgreFWGame.exe!__tmainCRTStartup() + 0x2a2 bytes C
OgreFWGame.exe!WinMainCRTStartup() + 0xf bytes C
kernel32.dll!76c63677()
ntdll.dll!775d9d42()
ntdll.dll!775d9d15()
Crash Screencapture:
link text
That is not how you are supposed to initialize and use Ogre. Most likely the missing initialization work is what causing your crash.
To get started with ogre I highly recommend following and learning from the tutorials
Edit:
visual studio project templates for ogre can be found here: http://code.google.com/p/ogreappwizards/updates/list to get started quickly.
Thanks for everybody's help on this problem. I ended up re-installing windows (I tried uninstalling Visual Studio and re-installing it, but something went wrong while uninstalling VS [I followed Microsoft's instructions to the letter] and it would refuse to install again [the setup would crash]). I wish they would make it easy to Uninstall Visual Studio.
I wasted about 3 days before I resorted to re-installing windows. My advice would be, if you have another computer to continue to do your work on, is to do the same if something like this happens rather than waste days. If you do find a way to fix the problem, please let me know :)
I recently set ogre up in Visual Studio 2010 and it refused to work right until I copied in the right DLLs - I had been using a set compiled from a slightly older version of ogre in Visual studio 2008. It sounds like the entire ogre compilation or the DLLs may have been copied over via the SVN which could cause strange problems.
Hope it helps, anyway.