We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you a podcast all about Citrix Workspace, moving to the cloud, and analytics & intelligence. Episode 2 coming soon!Listen Now

x

Directx Managed memory allocation problem.

Medium Priority
481 Views
Last Modified: 2013-12-21
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.
Comment
Watch Question

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.

-d

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts

Author

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.

Author

Commented:
I've found the solution in a previous question

http://www.experts-exchange.com/Programming/Game_Development/3D_Programming/Q_20788209.html?query=directx+float+precision&clearTAFilter=true


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,

-d
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.