Author Topic: Bug: vc.e leaks temp buffers  (Read 16969 times)

chrisant

  • Senior Community Member
  • Posts: 1410
  • Hero Points: 131
Bug: vc.e leaks temp buffers
« on: April 14, 2008, 06:08:47 pm »
Repro steps:
1.  Run list_buffers -h, make a note of any unnamed buffers.
2.  Run a version control command that captures output and copies it to the Output tool window.
3.  Run list_buffers -h again, notice there is a new leaked unnamed buffer.

Some investigation:
In vc.e, the function DisplayOutputFromView has an old commented-out implementation, but now it just calls _SccDisplayOutput.  The old commented out implementation used to delete the temp view, but it no longer does.  But neither _SccDisplayOutput nor the callers of DisplayOutputFromView delete the temp view.  So it seems that the new implementation of DisplayOutputFromView always leaks a temp buffer.

Dan

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 2686
  • Hero Points: 143
Re: Bug: vc.e leaks temp buffers
« Reply #1 on: April 15, 2008, 02:14:28 pm »
What version control system are you seeing this problem with?

chrisant

  • Senior Community Member
  • Posts: 1410
  • Hero Points: 131
Re: Bug: vc.e leaks temp buffers
« Reply #2 on: April 15, 2008, 05:49:03 pm »
It's a custom one not in the stock list, but will also occur for any command line based source control system configured to show its output in the Output tool window.  For example, Perforce (command line, not SCC).

Are you not seeing it occur?

"Capture errors from stdout and stderr" = ON
"Always show output" = ON

Dan

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 2686
  • Hero Points: 143
Re: Bug: vc.e leaks temp buffers
« Reply #3 on: April 15, 2008, 06:15:05 pm »
I see it with those settings.  Thank you.

Dan

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 2686
  • Hero Points: 143
Re: Bug: vc.e leaks temp buffers
« Reply #4 on: April 15, 2008, 07:15:08 pm »
Are you using SlickEdit 2008?

chrisant

  • Senior Community Member
  • Posts: 1410
  • Hero Points: 131
Re: Bug: vc.e leaks temp buffers
« Reply #5 on: April 16, 2008, 02:54:37 am »
I am currently using SlickEdit 2008, yes.
I first noticed it when using SlickEdit 2007.

In both the 12.0.3 and 13.0.0 versions of vc.e, the function DisplayOutputFromView has an old commented-out implementation, but the current (12+ at least) implementation just calls _SccDisplayOutput.  The old commented out implementation used to delete the temp view, but that no longer happens.  But neither _SccDisplayOutput nor the callers of DisplayOutputFromView delete the temp view.  So it seems that the current implementation of DisplayOutputFromView always leaks a temp buffer.

Dan

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 2686
  • Hero Points: 143
Re: Bug: vc.e leaks temp buffers
« Reply #6 on: April 16, 2008, 03:15:45 pm »
I just wanted to be sure that this fix would compile on your version.  A fix is attached, please let me know when you have tried it.

Backup your vc.e, and replace it with the one attached, then go to Macro>Load Module and choose vc.e.

chrisant

  • Senior Community Member
  • Posts: 1410
  • Hero Points: 131
Re: Bug: vc.e leaks temp buffers
« Reply #7 on: April 16, 2008, 06:36:23 pm »
Thanks, I picked up the delete_temp_view(ViewId) change and confirm that VC operations no longer leak temp buffers.

Dan

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 2686
  • Hero Points: 143
Re: Bug: vc.e leaks temp buffers
« Reply #8 on: April 16, 2008, 06:42:01 pm »
Thank you.  This fix will be in 13.0.1.

mychong

  • Community Member
  • Posts: 46
  • Hero Points: 0
Re: Bug: vc.e leaks temp buffers
« Reply #9 on: April 17, 2008, 01:18:40 am »
To Dan: If the same problem happened on v12.0.3, I would like to have a fix as well. Thanks.

chrisant

  • Senior Community Member
  • Posts: 1410
  • Hero Points: 131
Re: Bug: vc.e leaks temp buffers
« Reply #10 on: April 17, 2008, 07:44:53 am »
Dan can respond about whether an official hotfix will be available for 12.0.3, but in the meantime it's a very simple change to make manually:

Open the macros\vc.e file,
Go to the DisplayOutputFromView function,
Make it look like the following,
And then load the edited module (use the menu command Macro->Load Module).

Code: [Select]
static void DisplayOutputFromView(int ViewId)
{
   _SccDisplayOutput(ViewId,true,true);
   _delete_temp_view(ViewId);
}
So basically, delete all the commented-out lines in that function, except uncomment and keep the very last one (which deletes the temp view and fixes the leak).

mychong

  • Community Member
  • Posts: 46
  • Hero Points: 0
Re: Bug: vc.e leaks temp buffers
« Reply #11 on: April 17, 2008, 10:15:04 am »
@chrisant: Thanks. I made the modification to vc.e as suggested. But the problem remains. Every time I compiled my c source file with output captured, I noticed there were 2 additional Untitled<n> buffers added to the list. Not sure where went wrong. (I even tried restarting SE after loading in the modified module, but to no avail.) OS: Linux Fedora Core 1.

chrisant

  • Senior Community Member
  • Posts: 1410
  • Hero Points: 131
Re: Bug: vc.e leaks temp buffers
« Reply #12 on: April 17, 2008, 06:02:12 pm »
Wait...are we talking about the same thing?

I pointed out 1 temp view leak in version control operations (check out file, for example).
You seem to be pointing out 2 temp view leaks in build/compile operations.

The vc.e fix probably would not help build/compile issues.

Dan

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 2686
  • Hero Points: 143
Re: Bug: vc.e leaks temp buffers
« Reply #13 on: April 17, 2008, 06:03:46 pm »
I think Chrisant is probably right.  As far as I could tell the issue he originally reported would only happen for command line version control systems.

mychong

  • Community Member
  • Posts: 46
  • Hero Points: 0
Re: Bug: vc.e leaks temp buffers
« Reply #14 on: April 18, 2008, 12:16:52 am »
I don't use cvs within the SlickEdit, so I tried the fix with the compile command instead. It seems we need another fix/workaround for this buffer leak.