error message

Post general discussions on using our drivers to write your own software here
teck
Active User
Active User
Posts: 17
Joined: Sun Feb 25, 2007 4:48 pm

error message

Post by teck »

HI all, why is it that when i try to run the C++ streamingtest example it encounter the following error:

First-chance exception at 0x1000e746 in streamingtest_71.exe: 0xC0000005: Access violation reading location 0x01687000.
when i choose the sample settings as:

sample time units: "nano"

The program runs well with "micro" , "milli" as the time units settings.

markB
Site Admin
Site Admin
Posts: 83
Joined: Tue Mar 27, 2007 9:43 am
Location: Cambridgeshire,UK

Post by markB »

This problem should have been fixed already. There is an updated version of the example program in in the 5.16.2 download.

Regards

Mark

teck
Active User
Active User
Posts: 17
Joined: Sun Feb 25, 2007 4:48 pm

Post by teck »

hi,
i have tried to use the 5.16.2 version dl but i still encounter the same error now with "1micro second" as the time unit settings.

May i know what could the error be? What are the changes to the latest version(5.16.2) of the example file? What is it that is changed to remove this error i encounter? I raise this because i am using my own cpp file with the new version of ps3000.dll file only and not the whole VC++ project file.

markB
Site Admin
Site Admin
Posts: 83
Joined: Tue Mar 27, 2007 9:43 am
Location: Cambridgeshire,UK

Post by markB »

Hi

The only thing that changed was the dll. There are no changes to the example file.

Exactly what error do you get with the new dll? Does it work in the example program?
Regards

Mark

teck
Active User
Active User
Posts: 17
Joined: Sun Feb 25, 2007 4:48 pm

Post by teck »

hi,

i tried using both new dll together with the new program downloaded 5.16.2 and also with my own program with the new dll file. The error message i receive is the same access violation error. I am doing an auto mation with it and after running for about a thousand times of capturing it will show the access violation error msg 0xC0000005 in some address. May i know what exactly is wrong? I am using a P4, 256MB RAM and VC++.NET 2003. Attach is my file but seems that u would need to turn on and off a signal many times to get the error to appear.
Attachments
streamingTests.cpp
(43.72 KiB) Downloaded 826 times

markB
Site Admin
Site Admin
Posts: 83
Joined: Tue Mar 27, 2007 9:43 am
Location: Cambridgeshire,UK

Post by markB »

The error that you describe would suggest an uninitialised pointer somewhere.

I have tried the standard streamingTests.cpp example and I cannot repeat the problem. Unfortunately, we do not have the resources to debug user modified code.
Regards

Mark

teck
Active User
Active User
Posts: 17
Joined: Sun Feb 25, 2007 4:48 pm

Post by teck »

Hi, thanks for your solution.
I realise that my automation program call ps3000_run_streaming_ns() everytime it begins on a new start cycle. Each time i call this function it allocates new buffer to the computer's memory by address and not freeing it. Thus the computer's memory runs out over time and i encounter the access violation error as described earlier in my posts.
Is there anyway i can find the api or is it written in the dll to free it?
How can i free the memory allocated by the scope so that as new initialisation of ps3000_run_streaming_ns() will not cause memory leak.

markB
Site Admin
Site Admin
Posts: 83
Joined: Tue Mar 27, 2007 9:43 am
Location: Cambridgeshire,UK

Post by markB »

The API will pass a pointer to the data in the callback function. The pointer (and therefore the data) will only be valid for the duration of you callback. Its up to you to use or copy the data before the callback returns.

You may therefore copy the data into your own buffers during the callback. Its therefore up to you to allocate and free your own buffers. The dll will allocate and free its own buffers so there is no need for you to free any pointers that are passed to you, from the dll, during the callback.
Regards

Mark

teck
Active User
Active User
Posts: 17
Joined: Sun Feb 25, 2007 4:48 pm

Post by teck »

Hi,

What is the correct procedure if i want to get 10K samples, stop the device to get and process data and repeat this cycle over for many times?

I am now repeatedly initialising the device (calling ps3000_run_streaming_ns()), stop to retrieve and process data and i found that there is significant increase of the memory usage. I have debugged that even when i dont collect data, by only starting and stopping the scope repeatedly causes this increase in memory. Particularly after calling ps3000_run_streaming_ns.

It is mentioned that "the driver creates the overviewbuffers when you call ps3000_run_streaming_ns() to start fast streaming. " Does the problem lies here? Is it that i cannot repeatedly call this command?
Thanks in advance for the posts!

Regards,
teck

User avatar
markspencer
Site Admin
Site Admin
Posts: 598
Joined: Wed May 07, 2003 9:45 am

Post by markspencer »

Hi,

Thank you for the post.

When using the fast streaming mode the driver will create the overview buffer that will store the aggregated data and an additional storage facility to collect the unaggregated/raw data from the device. Both these staorage device require memory from the heap and will not release it until finished with, ie another run is started either in streaming mode or block mode.

You can call the ps3000_get_streaming_values as many times as you wish once with different aggregations once ps3000_has been stopped.

Best regards,
Mark S.
Regards,

Mark Spencer

teck
Active User
Active User
Posts: 17
Joined: Sun Feb 25, 2007 4:48 pm

Post by teck »

Hi,
For what i am doing now, i am getting a stream of data by running the streaming mode and then stopping the device when the auto_stop flag is true using ps3000_stop to get unagregated data and then starting the device again for the next capture using ps3000_run_streaming_ns. By doing this, i observe a memory leak.
May i know what could be the problem? even if i did not get unagregated data, just by starting the device and stopping it causes the memory to increase steadily.

What is it meant by "another run is started either in streaming mode or block mode" I have started repeatedly another run after the device stop. But this causes the memory leak in my situation.

Regards,
teck

teck
Active User
Active User
Posts: 17
Joined: Sun Feb 25, 2007 4:48 pm

Post by teck »

In addition to my earlier post, i would like to ask whats the significance of the number "18439" of the overview buffer size in the ps3000_run_streaming_ns command that is found in the example C++ program? Why is this particular number chosen?
ThankYou! :D

Regards,
teck

User avatar
markspencer
Site Admin
Site Admin
Posts: 598
Joined: Wed May 07, 2003 9:45 am

Post by markspencer »

Hi,

Sorry it has taken so long to get back to your query. We have been invesigating the posibility of the memory leak further. This has been discovered and resolved. I have attached the new file to this post it is ps3000.dll version 3.2.8.0,

The comment "another run is started either in streaming mode or block mode", is meant by calling any of these funtion calls, ps3000_run_streaming_ns, ps3000_run_streaming, or ps3000_run_block the device will start collecting samples again, and the driver will destroy any previous storage facitity.

The number 18349, when passed tothe driver is used to declare overview buffers two for each channel where the maximum and minimum aggregated data samples are returned through the callback function. The number can be smaller or larger. If the value is smaller then the overview buffer can become full if the data is not retreived quickly enough or if the aggregation is low the the overview buffers would fill up quickly, causing the data collection to stall.

Best regards,
Mark S.
Attachments
ps3000.zip
ps3000.zip contains driver ps3000.dll version 3.2.8.0, ps3000.lib and ps3000bc.lib
(245.38 KiB) Downloaded 665 times

teck
Active User
Active User
Posts: 17
Joined: Sun Feb 25, 2007 4:48 pm

Post by teck »

Hi, thanks a million for solving that guys!

The problem with the memory leaks looks fine now with the new version of the DLL and libraries files.

However, i realise that there is a maximum usage (100%) of the CPU usage from monitoring the task manager. Hmmm... Does this mean anything? As I will be running this for a few days non-stop in a lab environment.

Regards,
teck

ziko
Advanced User
Advanced User
Posts: 1705
Joined: Fri Dec 01, 2006 10:03 am
Location: St Neots

Post by ziko »

Hi the CPU usage can be high, it really does depend on you computer, any applications running and what you are doing in the PicoScope. So try closing all applications in the background.

Kind regards
Ziko

Technical Specialist

Post Reply