<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.kde.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugs.kde.org/"
          
          maintainer="sysadmin@kde.org"
>

    <bug>
          <bug_id>345860</bug_id>
          
          <creation_ts>2015-04-04 12:06:33 +0000</creation_ts>
          <short_desc>KZoneAllocator eats up too much memory on Windows</short_desc>
          <delta_ts>2015-08-24 12:37:34 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>3</classification_id>
          <classification>Frameworks and Libraries</classification>
          <product>frameworks-kcompletion</product>
          <component>general</component>
          <version>unspecified</version>
          <rep_platform>Microsoft Windows</rep_platform>
          <op_sys>Microsoft Windows</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>NOR</priority>
          <bug_severity>critical</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Andrius">andriusmao</reporter>
          <assigned_to name="David Gil">davidgiloliva</assigned_to>
          <cc>andriusmao</cc>
    
    <cc>kdelibs-bugs-null</cc>
    
    <cc>kfunk</cc>
    
    <cc>simonandric5</cc>
    
    <cc>windows-bugs-null</cc>
          
          <cf_commitlink>http://commits.kde.org/kcompletion/05167e5bf563f3b9b2465e9da2ecf1e4a86a0d4d</cf_commitlink>
          <cf_versionfixedin></cf_versionfixedin>
          <cf_sentryurl></cf_sentryurl>
          <votes>0</votes>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1508890</commentid>
    <comment_count>0</comment_count>
    <who name="Andrius">andriusmao</who>
    <bug_when>2015-04-04 12:06:33 +0000</bug_when>
    <thetext>Any app which uses KCompletion (e.g.: Kate) gets to use &gt; 4GB memory then crashes my entire machine if I&apos;m not quick enough to kill it. KZoneAllocator looks to be the culprit since by removing KCompTreeNode&apos;s custom operator new and delete does the trick.

Reproducible: Always

Steps to Reproduce:
1. Have KCompletion installed
2. Start Kate

Actual Results:  
My machine hangs due to eating a ton of memory and I need to force reboot.

Expected Results:  
Using more memory than the KZoneAllocator-less version but not that much.

Self compiled current git master version.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1508894</commentid>
    <comment_count>1</comment_count>
    <who name="Andrius">andriusmao</who>
    <bug_when>2015-04-04 12:12:17 +0000</bug_when>
    <thetext>MSVC 2013 Memory dump file.
https://drive.google.com/file/d/0B8v2oXr-gdg5UjItZk5oYkZPMWc/view?usp=sharing</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1508970</commentid>
    <comment_count>2</comment_count>
    <who name="David Gil">davidgiloliva</who>
    <bug_when>2015-04-05 07:49:04 +0000</bug_when>
    <thetext>Hi!

Thanks for reporting. Could you please attach the patch you&apos;ve made to remove KCompTreeNode&apos;s custom operator new and delete?

When I took over the maintenance of KCompletion I did a general cleanup, except for KZoneAllocator and related classes. I didn&apos;t dare to touch them and assumed they worked. Now I&apos;m studying them to see if I find something suspicious.

Besides, I don&apos;t have any Windows machine to compile it, test and confirm. Someone else will have to help here.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1509252</commentid>
    <comment_count>3</comment_count>
    <who name="Kevin Funk">kfunk</who>
    <bug_when>2015-04-07 08:14:16 +0000</bug_when>
    <thetext>How long does it take from starting Kate until running out of memory? Is it instant or after some time of usage?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1509283</commentid>
    <comment_count>4</comment_count>
    <who name="Andrius">andriusmao</who>
    <bug_when>2015-04-07 11:22:30 +0000</bug_when>
    <thetext>(In reply to Kevin Funk from comment #3)
&gt; How long does it take from starting Kate until running out of memory? Is it
&gt; instant or after some time of usage?

It grows as soon as it starts, taking ~20 seconds to render my computer unusable. The same happens with Qt designer as soon as it starts loading the available plugins (KCompletion again appears in the memory dump file).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1539071</commentid>
    <comment_count>5</comment_count>
    <who name="Kevin Funk">kfunk</who>
    <bug_when>2015-08-23 21:27:15 +0000</bug_when>
    <thetext>I think we&apos;ve found the issue. Will post a patch soonish.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1539191</commentid>
    <comment_count>6</comment_count>
    <who name="Kevin Funk">kfunk</who>
    <bug_when>2015-08-24 12:37:34 +0000</bug_when>
    <thetext>Git commit 05167e5bf563f3b9b2465e9da2ecf1e4a86a0d4d by Kevin Funk.
Committed on 24/08/2015 at 12:37.
Pushed by kfunk into branch &apos;master&apos;.

Fix bad behavior / running OOM on Windows

When testing KDevelop on Windows we sometimes experienced excessive use
of memory (&gt; 2 gigs of RAM allocated). This patch appears to fix the
issue.

Compiler warnings didn&apos;t sound promising either:
Z:\kderoot\download\git\kcompletion\src\kzoneallocator.cpp(129):
warning C4319: &apos;~&apos;: zero extending &apos;unsigned long&apos; to &apos;quintptr&apos; of greater size
Z:\kderoot\download\git\kcompletion\src\kzoneallocator.cpp(206):
warning C4319: &apos;~&apos;: zero extending &apos;unsigned long&apos; to &apos;quintptr&apos; of greater size
Z:\kderoot\download\git\kcompletion\src\kzoneallocator.cpp(256):
warning C4267: &apos;+=&apos;: conversion from &apos;size_t&apos; to &apos;unsigned long&apos;, possible loss of data
REVIEW: 124896

M  +3    -3    src/kzoneallocator.cpp

http://commits.kde.org/kcompletion/05167e5bf563f3b9b2465e9da2ecf1e4a86a0d4d</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>