From: David Wells Date: Mon, 1 Jun 2015 12:02:49 +0000 (-0400) Subject: Fix two issues with C string memory consumption. X-Git-Tag: v8.3.0-rc1~135^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9f7ef06f65b8c8e148c18487010ce26cc8c7b383;p=dealii.git Fix two issues with C string memory consumption. These were pointed out by @msteigemann. Including cstring to obtain strlen is not necessary with some GCC releases, but may be needed on other platforms. I rewrote the call to strlen so that it does not rely on the fact that sizeof(char) == 1 on most platforms. --- diff --git a/include/deal.II/base/memory_consumption.h b/include/deal.II/base/memory_consumption.h index 166d03f32b..c34e8f69a4 100644 --- a/include/deal.II/base/memory_consumption.h +++ b/include/deal.II/base/memory_consumption.h @@ -24,6 +24,7 @@ #include #include #include +#include DEAL_II_NAMESPACE_OPEN @@ -458,7 +459,7 @@ namespace MemoryConsumption } else { - return /*Don't forget about the NUL! :]*/ sizeof(char) + strlen(string); + return sizeof(char)*(strlen(string) /*Remember the NUL*/ + 1); } }