|
I have performed some tests by reducing the size of data requested in the call to BeginXferData .
I am using bulk endpoints and I am reading from the target device.
I have an array of 64 buffers all of 4096 bytes , an array of 64 context pointers and an array of 64 overlapped structures.
I perform a beginXferData for each of the 64 requests.
I then enter a loop where I
1. waitForXfer
2. finishDataXfer
3. beginXferData ( to repeat the request for data ).
this loop runs for 60 seconds.
For the record the setXferSize is still 65536
In between steps 2 and 3 I allocate 1/2 meg and deallocate it straight away , this is for testing purposes to see if there's an issue with memory collision somewhere between the API and the application. I must stress that this memory is never used it's not passed to anything it's just allocated and then deallocated.
I've still encountered the issue where the debugger reports heap memory corruption
"HEAP[Async.exe]: HEAP: Free Heap block a8ae60 modified at a8ae94 after it was freed
Windows has triggered a breakpoint inAsync.exe."
The rror is usually assosiated with FinishXferData or even the std::stream library but always heap corruption.
The only allocations are the initial 64 buffers , the allocation done by the API and my test allocation. The API allocates and deallocates the contexts the inital 64 buffers exist for the lifetime of the application and my test allocation is alloc'd and dealloc'd quickly during the loop. These allocations shouldn't be causing heap corruption.
My latest test seem to have only moved the fault further down the time scale so that it happens later rather than sooner. This is with 4096 as the BeginXferData size.
To me it looks like the API is corrupting heap memory and maybe I'm using the wrong CRT or target library to perform debugging ?
My requirement is to be able to read variable data rates but at the minute I can't even read a very slow data rate without this thing bombing out under debug conditions. I can't trust the release version at this stage as it might be accessing invalid memory segments during runtime causing corruption.
I'm using the latest version of the API from the site , I've tried it with earlier versions as well , the host controller is an Intel US15W with the device connected to a port that supports USB1.0 and USB 2.0. ( device is connected as USB 2.0 ).
Are there any specific settings I'm missing for the C++ / Linker options for debug? Should I only be working in Release mode ( which would seem odd ).
Would it help if I supplied the working code for you to test against?
|