Recent

Author Topic: heaptrace unable to read file [solved]  (Read 566 times)

jbmckim

  • Full Member
  • ***
  • Posts: 135
heaptrace unable to read file [solved]
« on: August 15, 2019, 06:44:04 pm »
Using heaptrace, I'm getting the attached error when I try to open a file (with line number) listed by heaptrace as being a problem. (i.e. Unable to read file <file name> <address>)  I'm not sure if this error is mapping to the source file or to the heaptrace file.  Ultimately, I don't care about that so much has to how to fix.  ;D  The source file in question compiles, runs, works per spec and opens successfully with an external editor.

As background: I'm in development right now (as opposed to maintenance) and am writing a lot of code. I take a time out at good stopping points and go back and clean up all my memory leaks.  There's usually a bit to do but I haven't seen this problem before.  Any ideas?

Thanks.
« Last Edit: January 27, 2020, 07:04:34 pm by jbmckim »

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 5962
    • wiki
Re: heaptrace unable to read file
« Reply #1 on: August 15, 2019, 06:48:00 pm »
Could you attach the heaptrc file? So I can try to reproduce this?

jbmckim

  • Full Member
  • ***
  • Posts: 135
Re: heaptrace unable to read file
« Reply #2 on: August 15, 2019, 06:55:13 pm »
Sure,

Here it is as a 7z since .trc won't upload.

jamie

  • Hero Member
  • *****
  • Posts: 2312
Re: heaptrace unable to read file
« Reply #3 on: August 15, 2019, 06:57:08 pm »
as far as I know HTrace isn't suppose to do anything until you exit however, I've seen it popup while executing code due to the fact that I corrupted the memory table.

 Heap trace will malfunction if you bleed over into other memory blocks because it loses control of the memory blocks and unexpected things like this happen..

 The reported line number may not even be the cause, it could be an effect of code elsewhere.

 I suspect that improper handling of memory objects is the cause.


Number 1 at blue screen app creations!

jamie

  • Hero Member
  • *****
  • Posts: 2312
Re: heaptrace unable to read file
« Reply #4 on: August 15, 2019, 06:58:12 pm »
Can you please provide a ZIP version of that file please.

7z is not a application I have installed.
Number 1 at blue screen app creations!

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 5962
    • wiki
Re: heaptrace unable to read file
« Reply #5 on: August 15, 2019, 07:13:14 pm »
I will have to debug the leak-view code. So this may be a short while.

Just to be sure, you used the "load from file", rather than the paste clipboard? So we can exclude the clipboard screwing around with the line endings?

Thaddy

  • Hero Member
  • *****
  • Posts: 9638
Re: heaptrace unable to read file
« Reply #6 on: August 15, 2019, 07:31:46 pm »
Did you go back and fixed all the warnings?
I am more like donkey than shrek

jbmckim

  • Full Member
  • ***
  • Posts: 135
Re: heaptrace unable to read file
« Reply #7 on: August 15, 2019, 07:45:58 pm »
jamie - zip is attached
Martin_fr - if you're willing to wade through the source, take all the time you need ;D
Thaddy - as above but more detail - this is one of those times when I'm cleaning all such things up.  So I'm only partially done cleaning.  I hit this "feature" pretty early on into the process. 

jbmckim

  • Full Member
  • ***
  • Posts: 135
Re: heaptrace unable to read file
« Reply #8 on: August 15, 2019, 10:38:30 pm »
Update:

It probably wasn't clear from my first post that not all the file/line references failed.  Hopefully, that is clear from the trace file.  I was able to work all the way through this batch of memory leaks.  Note that many warnings still remain to dispatch!

I look forward to hearing what was going on with the file access problem.

jamie

  • Hero Member
  • *****
  • Posts: 2312
Re: heaptrace unable to read file
« Reply #9 on: August 15, 2019, 10:49:32 pm »
it's obvious you are not releasing memory on some operations around that area of line numbers...

Also I assume you are not multi-threading at this time? Because it could be an issue with collision code.

 Without seeing some of the actual code that is generating this I would say you need to free up the resources you are creating..

 Most dynamic items do not release automatically, you need to do this, with the exception of managed items but I doubt you are using those in this case.
 
  So you need to check some code to see what is being created with the functions you are using, because they need to be released when you exit your app.

Number 1 at blue screen app creations!

jbmckim

  • Full Member
  • ***
  • Posts: 135
Re: heaptrace unable to read file
« Reply #10 on: August 15, 2019, 11:57:03 pm »
jamie - there are two real issues here. 

1) As stated in my previous post "I was able to work all the way through this batch of memory leaks."  My main leaks were caused by a TSpecList of objects where each object also contained an object.  The TSpecList is .Clear'ed and then .Free'ed. The main problem was that the sub-objects needed to be .Destroy'ed (i.e. at app close) prior to the TSpecList.  What hit me as odd in this was that the objects themselves were not presented as the problem but rather dynamic arrays they contained.  This made it a little confusing.  However, working from the top down, once I freed the sub objects the dynamic arrays they contain were no longer given as problems.  Heaptrc now returns nothing.

2) The second issue has more to do with HeapTrc itself.  A number of files referenced in the report could not be referenced from the Heaptrc form.  Attempting to do so would throw the error I attached above.  I suspect that will get look at in more detail as time passes.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 5962
    • wiki
Re: heaptrace unable to read file
« Reply #11 on: August 16, 2019, 12:45:25 am »
2) The second issue has more to do with HeapTrc itself.  A number of files referenced in the report could not be referenced from the Heaptrc form.  Attempting to do so would throw the error I attached above.  I suspect that will get look at in more detail as time passes.

That is the one I am on...

LeakView accepts quiet a few input formats that were accumulated over time.  The original code was never a charmer, and with more added.....

I recently noted some issues myself. So I am writing a unit test case for it now. And then fix it.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 5962
    • wiki
Re: heaptrace unable to read file
« Reply #12 on: August 17, 2019, 12:15:16 am »
I made some improvements: r61711 LeakView: fix various parsing issues

Still needs some major clean up....

jbmckim

  • Full Member
  • ***
  • Posts: 135
Re: heaptrace unable to read file
« Reply #13 on: January 27, 2020, 07:04:11 pm »
I'm backtracking on old posts of mine.

I'm going to mark this solved with the idea that heaptrc could benefit from continued attention.  Thanks Martin_fr for picking some of this up.