Directx Managed memory allocation problem.

Hi I'm trying to use Managed DirectX to display some CAD objects in a numerical simulation program written in C#.
The program requires the calculation of big sparse matrices that need a lot of memory.
The matrix solver is working fine and I could solve without problem the large linear system.
The problem comes when I've tried to add the classes for Directx display. The program doesn't crush nor throw a exception but the linear system gives totally different results.
I suppose that the Directx classes are messing with the memory i use for the matrix solver.
Does anyone know of memory allocation problems connected with the Managed Directx classes and are they any means to fix these problems?
I use the latest Directx SDK release.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

I've used DX for a decade, can't offhand recall any sort of memory overwrite issues -- and any that existed were likely because I was passing in bad ptrs to DX to start with.

Have you tried switching your DXSDK into Debug mode?  That activates more things like parameter checking (and likely some memory verification).

I mean, anything is possible, I'd just be surprised...  Are you sure you don't have uninitialized variables yourself, and that when you instantiate DX those uninitialized values change (stuff at different offsets...)?  I've seen that problem before a LOT.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
bogdanfunAuthor Commented:
Hi Davebytes

I think I found the reason why I get different results.
When I allocate the DirectX classes all the mathematical operation are apparently done in float precision even for double data. That's seriously affects the linear system solver.
For now I don't know why is this happening.
bogdanfunAuthor Commented:
I've found the solution in a previous question

Davebytes thanks for your try and I will award you the credits anyway.

You know, it's been so long since I've had to touch that flag I forgot all about it!

Yes, the D3D runtime switches the FPU into single-precision mode for performance.  Additionally, the FPU mode will get re-set every time you call into D3D (supposedly) if you flag FpuPreserve.  I wouldn't be surprised if some 3D engines might have actually set and restore the FPU state, around say physics computations, to control/reduce the overhead of D3D doing it constantly... But I could be wrong.

Glad you got it working,

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Game Programming

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.