Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
User name:
Password:
Save Password
Forgot your password?

 All Forums
 Visual Assist
 Technical Support
 Hangs on some template code
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

EugeneKozlov
Senior Member

Russia
39 Posts

Posted - Jan 17 2016 :  05:23:03 AM  Show Profile  Reply with Quote
Hello,

For a long time I see one annoying bug.
Sometimes Visual Assist cause Visual Studio 2015 hang for ~5 seconds. Task Manager shows huge memory allocation (~1 GB) during that hang.
This occurs when I am editing or reading code with some template stuff.
I have extracted quite small code that cause hangs for me.

Create empty project with two files.
main.cpp
#include "Binary.h"

int main()
{
    return 0;
}


Binary.h
#pragma once
#include <string>
using namespace std;

using sshort = int16_t;
using ushort = uint16_t;
using sint = int32_t;
using uint = uint32_t;
using slong = int64_t;
using ulong = uint64_t;

template <class Integer, class Type = void>
using EnableIfInteger2 = enable_if_t<is_integral<Integer>::value && (sizeof(Integer) > 1), Type>;

template <class Object>
struct Binary
{
    template <class Stream>
    static void read(Stream& stream, Object& object)
    {
        stream.read(&object, sizeof(object));
    }
    template <class Stream>
    static void write(Stream& stream, const Object& object)
    {
        stream.write(&object, sizeof(object));
    }
};
template <class Integer, class = EnableIfInteger2<Integer>>
struct BinaryInteger
{
    template <class Stream>
    static void read(Stream& stream, Integer& object)
    {
        stream.read(&object, sizeof(object));
        object = swapBytes(object);
    }
    template <class Stream>
    static void write(Stream& stream, const Integer& object)
    {
        Integer tmp = swapBytes(object);
        stream.write(&tmp, sizeof(tmp));
    }
};
template <>
struct Binary<ushort> : BinaryInteger<ushort> { };
template <>
struct Binary<sshort> : BinaryInteger<sshort> { };
template <>
struct Binary<uint> : BinaryInteger<uint> { };
template <>
struct Binary<sint> : BinaryInteger<sint> { };
template <>
struct Binary<ulong> : BinaryInteger<ulong> { };
template <>
struct Binary<slong> : BinaryInteger<slong> { };


Then try to edit the bottom part of Binary.h, click somewhere on names, scroll file, alt-tab Visual Studio, etc.

I have the latest release of VAX.

Thank you.

Edited by - EugeneKozlov on Jan 17 2016 05:35:01 AM

accord
Whole Tomato Software

United Kingdom
3287 Posts

Posted - Jan 17 2016 :  06:38:41 AM  Show Profile  Reply with Quote
I was able to reproduce the problem, thank you for the clear description.

case=94492
Go to Top of Page

sean
Whole Tomato Software

USA
2817 Posts

Posted - Feb 02 2016 :  7:46:55 PM  Show Profile  Reply with Quote
case=94492 is fixed in build 2089.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000