Forum Discussion

d_dwyer's avatar
d_dwyer
Occasional Contributor
15 years ago

Different behaviour when profiling

Hi



I have an application written in Delphi 2010.  A function in the application returns a string.  When this function is called whilst the applciation is being profiled the returned string is always empty!  When the application is being run from the Delphi IDE or normally from windows the function returns the correct string.



Does anyone know what AQtime is doing that could cause this problem to occur?  I have tried with AQtime 5 and the demo version of AQtime 7, both versions exhibit the same behaviour.



Thanks



Dave
  • Hi Dave,


    This can be a memory-related issue caused by the fact that AQtime changes the profiled application when instrumenting its code. If there are some problems with pointers in your application, this can result in a behavior change. Could you please provide us with a simple sample with which the problem can be reproduced?


    BTW, as a workaround, you can try excluding the problematic function from profiling (see the "Controlling what to profile" help topic ( http://www.automatedqa.com/support/viewarticle.aspx?aid=17905 ) for more information).

  • d_dwyer's avatar
    d_dwyer
    Occasional Contributor
    The problem had to do with the following code:



    MemoryStream.Read(cOne,  1);



    MemoryStream is a TMemoryStream and cOne was declared as a char.  Changing the declaration of cOne to an AnsiChar resolved the problem.  however, I am not sure why the code behaved differently in release and debug modes.



    Thanks



    Dave


  • Hi Dave,


    Thank you for the information. We can investigate the problem on our side if you provide us with a sample application or the source code of the problematic routine so we can try to reproduce this behavior here.

  • d_dwyer's avatar
    d_dwyer
    Occasional Contributor
    Allen



    Currently it is not very easy to create a sample application.  The code where the problem occurs requires some application configuration, TCP/IP communication to a hardware emulator and a database to store the hardware configuration.



    We have recently ported the application from Delphi 5 to Delphi 2010 and are in the process of testing the ported code.  I believe that the error is due to reading a Char variable from a TMemoryStream.  As previously stated the variable has now been changed to an AnsiChar and the code works correctly.



    Would you like me to send you the code for the function that is failing so you can see that?



    Thanks



    Dave