Memory Leak????

Memory Leak????

Postby Jeff Barnes » Fri Oct 29, 2010 9:24 pm

Hi,

In my program I display some data (graphically) and allow the user to "Page" through the data.
This all worked perfectly until I added some IF/ELSE/ENDIF statements.

The strange thing is the IF/ELSE statements only changed some numeric values. But now I am getting what I think is a memory leak.

The statements I added are similar to this:
Code: Select all  Expand view

IF nGraphSize = 0
   Rectangle(oDlgGraph:hDc, 185,xx,395,xx+1,hPenSpo2)
ELSE
   Rectangle(oDlgGraph:hDc, 335,xx,395,xx+1,hPenSpo2)
ENDIF
 


Basically if nGraphSize = 0 it uses all the original values (from when I did not have the problem).

I am at a loss as to why this is happening.

This is what the screen should look like:
Image


This is what happens after the user has "paged" through the data:

Image

I can't really provide a self contained sample of code that will show this.

Can someone PLEASE point me in the right direction. :(
Thanks,
Jeff Barnes

(FWH 16.11, xHarbour 1.2.3, Bcc730)
User avatar
Jeff Barnes
 
Posts: 929
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada

Re: Memory Leak????

Postby James Bott » Fri Oct 29, 2010 10:19 pm

Jeff,

Why do you think it is a memory issue? Have you checked it before and after?

Try changing the 335 to the original value (185) and leaving the IF/ELSE as is. If this works as it used to then try chaning the value to 186, then 187, etc until the problem starts.

It 335 a location off the chart maybe?

Maybe the XX value is getting changed when it shouldn't be?

Just some random ideas.

Regards,
James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: Memory Leak????

Postby Jeff Barnes » Fri Oct 29, 2010 11:12 pm

Hi James,

Thanks for the ideas....

The value of nGraphSize in stored in an ini file that get loaded at the start of the program.
If I leave it at 0 I still get the problem (at this point is should act as it was before I added the new code).

I'm thinking it's a memory problem because I can page through about 75% of the data (a large array containing a data point every 4 seconds for about 11 hours) ... if I rem out the part that draws the actual data lines the problem is not there.
The way the gray shaded areas are turned black, the missing text on the screen and the way the buttons are not redrawn correctly all make me think there is something going on with memory.

Also, the position bar for some reason is redrawn at the top of the screen .... nothing was changed that would affect the position bar.

This is compiled with the older FWH 7.11 ... I thought maybe recompiling with 10.9 would help but as you can see from my other post I'm having issues there too. http://forums.fivetechsupport.com/viewtopic.php?f=3&t=20159
Thanks,
Jeff Barnes

(FWH 16.11, xHarbour 1.2.3, Bcc730)
User avatar
Jeff Barnes
 
Posts: 929
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada

Re: Memory Leak????

Postby Jeff Barnes » Sat Oct 30, 2010 12:25 am

I have recompiled with the 10.9 FWH ... Still having the problem. RATS !!!!!!!
Thanks,
Jeff Barnes

(FWH 16.11, xHarbour 1.2.3, Bcc730)
User avatar
Jeff Barnes
 
Posts: 929
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada

Re: Memory Leak????

Postby richard-service » Sat Oct 30, 2010 12:51 am

Try to run your application into display card PC( not on board ).
Best Regards,

Richard

Harbour 3.2.0dev (r2402101027) => Borland C++ v7.7 32bit
MySQL v8.0 /ADS v10
Harbour 3.2.0dev (r2011030937) => Borland C++ v7.4 64bit
User avatar
richard-service
 
Posts: 803
Joined: Tue Oct 16, 2007 8:57 am
Location: New Taipei City, Taiwan

Re: Memory Leak????

Postby Jeff Barnes » Sat Oct 30, 2010 1:07 am

My PC uses a high end video card. I am also able to reproduce the problem on my laptop.
Thanks,
Jeff Barnes

(FWH 16.11, xHarbour 1.2.3, Bcc730)
User avatar
Jeff Barnes
 
Posts: 929
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada

Re: Memory Leak????

Postby Antonio Linares » Sat Oct 30, 2010 6:08 am

Jeff,

Please place these calls in your code:
Code: Select all  Expand view

IF nGraphSize = 0
   Rectangle(oDlgGraph:hDc, 185,xx,395,xx+1,hPenSpo2)
   LogFile( "info.txt", { 185, xx, 395, xx+1 } )
ELSE
   Rectangle(oDlgGraph:hDc, 335,xx,395,xx+1,hPenSpo2)
   LogFile( "info.txt", { 335, xx, 395, xx+1 } )
ENDIF
 

and copy here the values that you get in file.txt for those sections that fail
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42082
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Memory Leak????

Postby Jeff Barnes » Sat Oct 30, 2010 1:49 pm

I figured it out :D

It was a poorly used ".and." that messed everything up.

I had done something like this:
Code: Select all  Expand view
IF nRow > 275 .and. nGraphSize = 0


Where it should have been:
Code: Select all  Expand view
IF nGRaphSize = 0
   IF nRow > 275
 


Thanks to all for your help.
Thanks,
Jeff Barnes

(FWH 16.11, xHarbour 1.2.3, Bcc730)
User avatar
Jeff Barnes
 
Posts: 929
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: nageswaragunupudi, RSalazarU and 66 guests