220 13773 <8948B587-EFBF-476F-BBE2-DAEA00373AC1@gmail.com> article
Path: news.gmane.org!not-for-mail
From: David Krauss <potswa@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Stricter semantics for moved into objects with operator=(T&&)
Date: Thu, 9 Oct 2014 11:57:53 +0800
Lines: 61
Approved: news@gmane.org
Message-ID: <8948B587-EFBF-476F-BBE2-DAEA00373AC1@gmail.com>
References: <567868a2-a0aa-4fb9-993e-0d2a27c11a73@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\))
Content-Type: multipart/alternative; boundary="Apple-Mail=_78983927-3BEB-4226-88F9-982B336EF5A7"
X-Trace: ger.gmane.org 1412827096 5839 80.91.229.3 (9 Oct 2014 03:58:16 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Thu, 9 Oct 2014 03:58:16 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCW25A7E3QCRBT4P3CQQKGQEKPBWS4Y@isocpp.org Thu Oct 09 05:58:10 2014
Return-path: <std-proposals+bncBCW25A7E3QCRBT4P3CQQKGQEKPBWS4Y@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-yk0-f200.google.com ([209.85.160.200])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBCW25A7E3QCRBT4P3CQQKGQEKPBWS4Y@isocpp.org>)
	id 1Xc4rh-0007QW-4z
	for gclcip-std-proposals@m.gmane.org; Thu, 09 Oct 2014 05:58:09 +0200
Original-Received: by mail-yk0-f200.google.com with SMTP id 200sf1946011ykr.11
        for <gclcip-std-proposals@m.gmane.org>; Wed, 08 Oct 2014 20:58:08 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:from:message-id:mime-version:subject:date
         :references:to:in-reply-to:x-original-sender
         :x-original-authentication-results:reply-to:precedence:mailing-list
         :list-id:list-post:list-help:list-archive:list-subscribe
         :list-unsubscribe:content-type;
        bh=tFE0NzKzcU73u69oucmn9Cbp7aoDjB1LPsqWwWKpjkA=;
        b=ZQM+3Zx3aERahwXTW4ZGZ+vsddvYZBbMzA56j9tIZP+UGwiuIYWjFykpLmS+LZ3BfS
         UOGDapAf55vWe1EO4KoCWpNW6kF6w5spW6wHiv2nvzQvAv9PSnMCop7IiRzjZZ/IF2P7
         dCTzeBdLZ/iWgpsh8GmVoRMyjgc98d93znbfzw6Sz/xamy3NBEvzB/L18dZVTuOfg408
         ZLLplb+oBsLsfdNBihQrC9oouYR5W1n0b7fBmE4/lXA3cwegwXv8XoLlC4zacgaGouV/
         1sEW4N54jG/CxnrOMxLQyPEqqesfDVCwWUrDtBzK/deNQ3JviB3W4FpwO1HCN2aah/pT
         2FrA==
X-Gm-Message-State: ALoCoQk99IPYB4GEGFfsXAY0RSGPuWqQbZeflAoSr3h1RyUBA92rx9PXP+pj777hez0Qt22DbWAN
X-Received: by 10.236.41.102 with SMTP id g66mr9982876yhb.15.1412827088211;
        Wed, 08 Oct 2014 20:58:08 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.50.4.8 with SMTP id g8ls1959609igg.42.canary; Wed, 08 Oct 2014
 20:58:07 -0700 (PDT)
X-Received: by 10.51.17.66 with SMTP id gc2mr4386986igd.40.1412827087681;
        Wed, 08 Oct 2014 20:58:07 -0700 (PDT)
Original-Received: from mail-ig0-x229.google.com (mail-ig0-x229.google.com [2607:f8b0:4001:c05::229])
        by mx.google.com with ESMTPS id my9si7549751icb.46.2014.10.08.20.58.07
        for <std-proposals@isocpp.org>
        (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
        Wed, 08 Oct 2014 20:58:07 -0700 (PDT)
Received-SPF: pass (google.com: domain of potswa@gmail.com designates 2607:f8b0:4001:c05::229 as permitted sender) client-ip=2607:f8b0:4001:c05::229;
Original-Received: by mail-ig0-f169.google.com with SMTP id uq10so1281456igb.4
        for <std-proposals@isocpp.org>; Wed, 08 Oct 2014 20:58:07 -0700 (PDT)
X-Received: by 10.42.243.1 with SMTP id lk1mr3369595icb.51.1412827087254;
        Wed, 08 Oct 2014 20:58:07 -0700 (PDT)
Original-Received: from [172.20.10.2] ([121.54.54.129])
        by mx.google.com with ESMTPSA id oq6sm11607654igb.2.2014.10.08.20.58.04
        for <std-proposals@isocpp.org>
        (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
        Wed, 08 Oct 2014 20:58:07 -0700 (PDT)
In-Reply-To: <567868a2-a0aa-4fb9-993e-0d2a27c11a73@isocpp.org>
X-Mailer: Apple Mail (2.1878.6)
X-Original-Sender: potswa@gmail.com
X-Original-Authentication-Results: mx.google.com;       spf=pass (google.com:
 domain of potswa@gmail.com designates 2607:f8b0:4001:c05::229 as permitted
 sender) smtp.mail=potswa@gmail.com;       dkim=pass header.i=@gmail.com;
       dmarc=pass (p=NONE dis=NONE) header.from=gmail.com
Precedence: list
Mailing-list: list std-proposals@isocpp.org; contact std-proposals+owners@isocpp.org
List-ID: <std-proposals.isocpp.org>
X-Google-Group-Id: 399137483710
List-Post: <http://groups.google.com/a/isocpp.org/group/std-proposals/post>, <mailto:std-proposals@isocpp.org>
List-Help: <http://support.google.com/a/isocpp.org/bin/topic.py?topic=25838>, <mailto:std-proposals+help@isocpp.org>
List-Archive: <http://groups.google.com/a/isocpp.org/group/std-proposals/>
List-Subscribe: <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>,
 <mailto:std-proposals+subscribe@isocpp.org>
List-Unsubscribe: <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>,
 <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:13773
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/13773>

--Apple-Mail=_78983927-3BEB-4226-88F9-982B336EF5A7
Content-Type: text/plain; charset=ISO-8859-1


On 2014-10-09, at 9:48 AM, Matthew Fioravante <fmatthew5876@gmail.com> wrote:

> At the end of this sequence, 3GB of memory will be in use and on a memory constrained system, this could cause an out of memory error simply because we used move semantics (which is supposed to be a optimization!) instead of copy.

Whenever you actually need to free memory, you need to swap with an empty object. Even clear() won't do.

Having capacity in moved-from or otherwise empty vectors is an important optimization, because they are likely to refer to hot cache lines.

-- 

--- 
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

--Apple-Mail=_78983927-3BEB-4226-88F9-982B336EF5A7
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset=ISO-8859-1

<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html charset=
=3Dwindows-1252"></head><body style=3D"word-wrap: break-word; -webkit-nbsp-=
mode: space; -webkit-line-break: after-white-space;"><br><div><div>On 2014&=
ndash;10&ndash;09, at 9:48 AM, Matthew Fioravante &lt;<a href=3D"mailto:fma=
tthew5876@gmail.com">fmatthew5876@gmail.com</a>&gt; wrote:</div><br class=
=3D"Apple-interchange-newline"><blockquote type=3D"cite"><div style=3D"font=
-family: Helvetica; font-size: 12px; font-style: normal; font-variant: norm=
al; font-weight: normal; letter-spacing: normal; line-height: normal; orpha=
ns: auto; text-align: start; text-indent: 0px; text-transform: none; white-=
space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: =
0px;">At the end of this sequence, 3GB of memory will be in use and on a me=
mory constrained system, this could cause an out of memory error simply bec=
ause we used move semantics (which is supposed to be a optimization!) inste=
ad of copy.</div></blockquote></div><br><div>Whenever you actually need to =
free memory, you need to swap with an empty object. Even clear() won&rsquo;=
t do.</div><div><br></div><div>Having capacity in moved-from or otherwise e=
mpty vectors is an important optimization, because they are likely to refer=
 to hot cache lines.</div></body></html>

<p></p>

-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

--Apple-Mail=_78983927-3BEB-4226-88F9-982B336EF5A7--

.
