Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
OpenWalnut
OpenWalnut Core
Commits
6a08886a
Commit
6a08886a
authored
Jul 20, 2010
by
Robert Frohl
Browse files
[FIX] memory leak from calculateMapping()
parent
001eb64e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
3 deletions
+4
-3
src/common/WHistogram.cpp
src/common/WHistogram.cpp
+3
-2
src/common/WHistogram.h
src/common/WHistogram.h
+1
-1
No files found.
src/common/WHistogram.cpp
View file @
6a08886a
...
...
@@ -31,7 +31,7 @@
#include "WHistogram.h"
WHistogram
::
WHistogram
(
boost
::
shared_ptr
<
WValueSetBase
>
valueSet
)
//, unsigned int nBuckets )
WHistogram
::
WHistogram
(
boost
::
shared_ptr
<
WValueSetBase
>
valueSet
)
{
// calculate min max
m_minimum
=
wlimits
::
MAX_DOUBLE
;
...
...
@@ -137,7 +137,8 @@ void WHistogram::calculateMapping( double intervalSize )
unsigned
int
*
mappedBuckets
=
new
unsigned
int
[
m_nMappedBuckets
];
memset
(
mappedBuckets
,
0
,
m_nMappedBuckets
*
sizeof
(
unsigned
int
)
);
//*mappedBuckets = { 0 }; // works with C++0x
m_mappedBuckets
.
swap
(
*
new
boost
::
scoped_array
<
unsigned
int
>
(
mappedBuckets
)
);
boost
::
scoped_array
<
unsigned
int
>
scoped
(
mappedBuckets
);
m_mappedBuckets
.
swap
(
scoped
);
unsigned
int
index
=
0
;
for
(
unsigned
int
i
=
0
;
i
!=
m_nInitialBuckets
;
++
i
)
{
...
...
src/common/WHistogram.h
View file @
6a08886a
...
...
@@ -120,7 +120,7 @@ class WHistogram
* \param valueSet source of the data for the histogram
* \param nBuckets number of buckets this histogram should display
**/
explicit
WHistogram
(
boost
::
shared_ptr
<
WValueSetBase
>
valueSet
);
//, unsigned int nBuckets = 1000 );
explicit
WHistogram
(
boost
::
shared_ptr
<
WValueSetBase
>
valueSet
);
/**
* Copy constructor. If another interval size is given setInterval() is called and a
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment