forked from Ivasoft/DSView
Improve memory alloc and free for each capture
This commit is contained in:
@@ -54,7 +54,7 @@ GroupSnapshot::GroupSnapshot(const boost::shared_ptr<LogicSnapshot> &_logic_snap
|
||||
{
|
||||
assert(_logic_snapshot);
|
||||
|
||||
boost::lock_guard<boost::recursive_mutex> lock(_mutex);
|
||||
//boost::lock_guard<boost::recursive_mutex> lock(_mutex);
|
||||
memset(_envelope_levels, 0, sizeof(_envelope_levels));
|
||||
_data = _logic_snapshot->get_data();
|
||||
_sample_count = _logic_snapshot->get_sample_count();
|
||||
@@ -96,20 +96,30 @@ GroupSnapshot::GroupSnapshot(const boost::shared_ptr<LogicSnapshot> &_logic_snap
|
||||
|
||||
GroupSnapshot::~GroupSnapshot()
|
||||
{
|
||||
boost::lock_guard<boost::recursive_mutex> lock(_mutex);
|
||||
//boost::lock_guard<boost::recursive_mutex> lock(_mutex);
|
||||
BOOST_FOREACH(Envelope &e, _envelope_levels)
|
||||
free(e.samples);
|
||||
}
|
||||
|
||||
void GroupSnapshot::init()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void GroupSnapshot::clear()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
uint64_t GroupSnapshot::get_sample_count() const
|
||||
{
|
||||
boost::lock_guard<boost::recursive_mutex> lock(_mutex);
|
||||
//boost::lock_guard<boost::recursive_mutex> lock(_mutex);
|
||||
return _sample_count;
|
||||
}
|
||||
|
||||
void GroupSnapshot::append_payload()
|
||||
{
|
||||
boost::lock_guard<boost::recursive_mutex> lock(_mutex);
|
||||
//boost::lock_guard<boost::recursive_mutex> lock(_mutex);
|
||||
|
||||
// Generate the first mip-map from the data
|
||||
append_payload_to_envelope_levels();
|
||||
@@ -126,7 +136,7 @@ const uint16_t* GroupSnapshot::get_samples(
|
||||
|
||||
int64_t i;
|
||||
uint16_t tmpl, tmpr;
|
||||
boost::lock_guard<boost::recursive_mutex> lock(_mutex);
|
||||
//boost::lock_guard<boost::recursive_mutex> lock(_mutex);
|
||||
|
||||
uint16_t *const data = new uint16_t[end_sample - start_sample];
|
||||
// memcpy(data, (uint16_t*)_data + start_sample, sizeof(uint16_t) *
|
||||
@@ -155,7 +165,7 @@ void GroupSnapshot::get_envelope_section(EnvelopeSection &s,
|
||||
assert(start <= end);
|
||||
assert(min_length > 0);
|
||||
|
||||
boost::lock_guard<boost::recursive_mutex> lock(_mutex);
|
||||
//boost::lock_guard<boost::recursive_mutex> lock(_mutex);
|
||||
|
||||
const unsigned int min_level = max((int)floorf(logf(min_length) /
|
||||
LogEnvelopeScaleFactor) - 1, 0);
|
||||
|
||||
Reference in New Issue
Block a user