Handling multiple D3D devices in one program - direct3d

I have a console app where rendering is done via D3D. Now, I created a ConsoleCollection class that could house and render several instances of such console. Unfortunately, now I get an error saying "Attempted to read/write protected memory" at the DrawPrimitives() stage, and I suspect this is due to the creation of more than one device (but am not sure).
Can someone suggest what I can try to figure this out?

Related

Out of Memory Issue(java.lang.outofmemory) in J2ME LWUIT

I am developing J2ME (LWUIT) Application without any theme.
In Nokia 206 device am facing Out of Memory issue (java.lang.outofMemory)
My JAR size is 404 KB
This issue is not coming consistent it is coming sometimes
I have done R and D on this issue but did not get any Proper Solution.
If any one have any idea please help me on solving this issue.
More Specifications :-----
I am working on Questionnaire app, which has screens with dynamic fields data handling, means UI LWUIT components are created by parsing and reading from JSON object received from server, same way send the data dynamically to server using JSON, meanwhile when i try to make transaction app shows outOfMemory issue, sometimes it doesn't show for 10 transactions and sometime it shows in 1-2 transactions after login.
I tried with making transaction exit app, again login and make transaction then after some attemt just after login i get outOfMemory issue.
I am using LWUIT library, i checked removing the theme from app but still the problem exist.
What could be the issue?
Thanks in Advance
reading from JSON object received from server, same way send the data
dynamically to server using JSON
This is likely your problem. You are most likely spawning network threads but not cleaning them up. Do you have the same issue if you don't make any network transactions?
Try using your emulators memory diagnostic if its available and see when the RAM spikes up.
EDIT: We still need more details if you want help, post what you've tried already or some sample code and help us narrow it down
Fenix

MonoTouch Running differently on IOS Emulator than on IPad

I'm having issues around my app (basically a modified Mobile World Conference) app when I run it on the IOS Emulator in windows, verses running it directly on the IPad itself. I understand that there is a different process or involved so I don't expect it to be exactly the same.
In specific, I'm getting errors around initializing sql databases (SqlLite) with errors being
"Object Not Defined"
When I try and single step debug to the device, I get errors that feel like somehow the stack has been corrupted and I can not even debug into methods.
My question is, what are the types of differences I can look for and how to debug them? There must be some pattern of things that cause issues, I just have no idea what that is or how to figure it out. I'm use to my c# code just working on x86.
What causes simulator to behave differently? Simulator is not constrained in memory usage like a real device so you're likely to hit memory warnings on the device (and crash if you don't handle them properly). The code itself, however, runs faster so race conditions between threads are more likely, so watch out for that. Don't talk to database from different threads, or at least use proper locking. And of course there are AOT limitations which occur only on the device. Your LINQ problem sounds like a AOT problem to me.

J2ME: How to inspect application's crash which doesn't throw any visible exception?

I develop multimedial application within the Java ME platform. It's application usable for voice recording and after replaying.
I have treated many pieces of code by try/catch block, which should provide an alert in the case an exception occured. The application works fine on java emulator but on Symbian phone it seems fine but the application crashes after some minutes of working without any message and also without any system message. It just falls down, the application is abruptly terminated.
Is there any way how to find where's the problem? I've tried to surround all big pieces of code by try/catch block but the result is same.
Thanks for you advice
I recommend using the Symbian on device debugger or tracing on the device to determine the exact location of the problem.
You can log to file on the device every step that you make before it stops and after like "I'm doing XYZ" with timestamps and other stuff like variables values then try to figure out what is going on. Of course You'll get only stuff that happened before crash but it can give You some new info.

Creating objects suddenly begins failing after they have been loaded in memory successfully

Behavior:
Application is loaded and being used as expected.
Suddenly, a particular DLL can no longer be loaded. The error message is:
ActiveX component cannot create object.
In each case, the object had been created successfully many times before failure. All objects are marked for "retain in memory".
This error is cleared when the application pool is recycled. It may be hours or months before it is seen again.
Issue has happened within two hours of a refresh, as well as never happened in months of uptime.
Issue has happened with hundreds of simultaneous users (heavy usage) and also with 1-3 users.
While the issue is occurring, the process running that application pool cannot create the object that is failing. However it can create any other objects. Memory, CPU, and other resources all remain at normal usage. In addition, other processes (such as a stand-alone exe) can successfully create the object.
The first instance of the issue appeared in mid 2008. There have been less than fifty instances since then, despite a pool of hundreds of servers for it to occur on. All instances except one have failed on the same DLL.
DLL Failure Info:
most common - generic data structure implementing a b-tree, has no references other than to its interface. Code consists of arrays and one use of the vb6 Event functionality. The object has not been changed in any way since 2005.
one-time - interop to a .NET module. the failure is occurring when trying to create the interop object, not the .NET object. This object is updated a few times each year.
Application Environment:
IIS hosted application
VB6, classic ASP, some interop to minor .NET components
Windows Server 2003 / Windows Server 2008 (both have independently had the problem)
Attempts to Reproduce:
Using scripts (and real-life humans) to run the same end-user workflows that our logs reported the days before the issue occurred.
Using scripts to create/destroy suspected objects as fast as possible from multiple simultaneous sessions.
Wild speculation.
No intentional success, but it does manifest randomly on the servers on its own.
Troubleshooting:
Code reviews
Test harnesses to investigate upper limits of object creation / destruction
Verification of ability to create object outside of the process experiencing the issue
Monitoring of resources over time on servers under load
Review of IIS, error, and event logs to determine events leading up to issue
Questions:
Any ideas on how to reproduce the issue?
What could cause this behavior?
Ideas for bypassing the first two questions in favor of a fast solution?
The DLL isn't on a network drive is it? You can get "glitches" where the drive is not available momentarily that then means COM can't do what it needs and could then fail to notice the drive is available again.
I used Process Monitor to debug similar problem when accessing ADO/OLEDB stack. Turned out environment got corrupted at some point and ADO classes are registered with InprocServer32 being REG_EXPAND_SZ pointing to %CommonProgramFiles%\System\ado\msado15.dll or similar ot x64 OSes.
Also when you register an application with Restart Manager, on failure the process gets restarted by winlogon process whose environment is different than explorer's one and unfortunately is missing %CommonProgramFiles% -- ouch!
This seems like a random failure; some race condition.
Try VMWARE to record the state of the machine you run this dll on. When the error happens you can then replay the record and inspect the memory contents. That why you won't have to play try and catch the error. At least you will have a solid record of it.
While I can't provide a solution, try catching the error and retry loading the dll when this happens after a refresh to the environment.

Is it possible to upload data as a background process in j2me?

Even with a poor network connection?
Specifically, I've written code which launches a separate thread (from the UI) that attempts to upload a file via HTTP POST. I've found, however, that if the connection is bad, the processor gets stuck on outputstream.close() or httpconnection.getheaderfield() or any read/write which forces data over the network. This causes not only the thread to get stuck, but steals the entire processor, so even the user interface becomes unresponsive.
I've tried lowering the priority of the thread, to no avail.
My theory is that there is no easy way of avoiding this behavior, which is why all the j2me tutorial instruct developers to create a ‘sending data over the network…’ screen, instead of just sending everything in a background thread. If someone can prove me wrong, that would be fantastic.
Thanks!
One important aspect is you need to have a generic UI or screen that can be displayed when the network call in background fails. It is pretty much a must on any mobile app, J2ME or otherwise.
As Honza said, it depends on the design, there are so many things that can be done, like pre-fetching data on app startup, or pre-fetching data based on the screen that is loaded (i.e navigation path), or having a default data set built in into the app etc.
Another thing that you can try is a built-in timer mechanism that retries data download after certain amount of time, and aborting after say 5 tries or 1-2 minutes and displaying generic screen or error message.
Certain handsets in J2ME allow detection of airplane mode, if possible you can detect that and promptly display an appropriate screen.
Also one design that has worked for me is synchronizing UI and networking threads, so that they dont lock up each other (take this bit of advice with heavy dose of salt as I have had quite a few interesting bugs on some samsung and sanyo handsets because of this)
All in all no good answer for you, but different strategies.
It pretty much depends on how you write the code and where you run it. On CLDC the concept of threading is pretty limited and if any thread is doing some long lasting operation other threads might be (and usualy are) blocked by it as well. You should take that into account when designing your application.
You can divide your file data into chunks and then upload with multiple retries on failure. This depends on your application strategy . If your priority is to upload a bulk data with out failure. You need to have assemble the chunks on server to build back your data . This may have the overhead for making connections but the chance is high for your data will get uploaded . If you are not uploading files concurrently this will work with ease .

Resources