本文整理汇总了C++中MM_FREE函数的典型用法代码示例。如果您正苦于以下问题:C++ MM_FREE函数的具体用法?C++ MM_FREE怎么用?C++ MM_FREE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了MM_FREE函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: CAL_Shutdown
/*
-----------------------------------------------------------------------------
Function: CAL_Shutdown() -Shutdown module.
Parameters: Nothing.
Returns: Nothing.
Notes: Frees grstarts, pictable and grsegs data. Closes grhandle file handle.
-----------------------------------------------------------------------------
*/
PUBLIC void CAL_Shutdown( void )
{
W32 i;
if( grstarts )
{
MM_FREE( grstarts );
}
if( pictable )
{
MM_FREE( pictable );
}
if( grhandle )
{
fclose( grhandle );
}
for( i = 0; i < NUMCHUNKS; ++i )
{
if( grsegs[ i ] )
{
MM_FREE( grsegs[ i ] );
}
}
}
开发者ID:QuinnEbert,项目名称:Wolf3D-iOS,代码行数:39,代码来源:wolf_gfx.c
示例2: ba_reader
void SampleBuffer::loadFromBase64( const QString & _data )
{
char * dst = NULL;
int dsize = 0;
base64::decode( _data, &dst, &dsize );
#ifdef LMMS_HAVE_FLAC_STREAM_DECODER_H
QByteArray orig_data = QByteArray::fromRawData( dst, dsize );
QBuffer ba_reader( &orig_data );
ba_reader.open( QBuffer::ReadOnly );
QBuffer ba_writer;
ba_writer.open( QBuffer::WriteOnly );
flacStreamDecoderClientData cdata = { &ba_reader, &ba_writer } ;
FLAC__StreamDecoder * flac_dec = FLAC__stream_decoder_new();
FLAC__stream_decoder_set_read_callback( flac_dec,
flacStreamDecoderReadCallback );
FLAC__stream_decoder_set_write_callback( flac_dec,
flacStreamDecoderWriteCallback );
FLAC__stream_decoder_set_error_callback( flac_dec,
flacStreamDecoderErrorCallback );
FLAC__stream_decoder_set_metadata_callback( flac_dec,
flacStreamDecoderMetadataCallback );
FLAC__stream_decoder_set_client_data( flac_dec, &cdata );
FLAC__stream_decoder_init( flac_dec );
FLAC__stream_decoder_process_until_end_of_stream( flac_dec );
FLAC__stream_decoder_finish( flac_dec );
FLAC__stream_decoder_delete( flac_dec );
ba_reader.close();
orig_data = ba_writer.buffer();
printf("%d\n", (int) orig_data.size() );
m_origFrames = orig_data.size() / sizeof( sampleFrame );
MM_FREE( m_origData );
m_origData = MM_ALLOC( sampleFrame, m_origFrames );
memcpy( m_origData, orig_data.data(), orig_data.size() );
#else /* LMMS_HAVE_FLAC_STREAM_DECODER_H */
m_origFrames = dsize / sizeof( sampleFrame );
MM_FREE( m_origData );
m_origData = MM_ALLOC( sampleFrame, m_origFrames );
memcpy( m_origData, dst, dsize );
#endif
delete[] dst;
m_audioFile = QString();
update();
}
开发者ID:floft,项目名称:lmms,代码行数:60,代码来源:SampleBuffer.cpp
示例3: message_data_race
void message_data_race(struct messaging_state *state, unsigned int eip,
unsigned int most_recent_syscall, bool confirmed)
{
struct output_message m;
m.tag = DATA_RACE;
m.content.dr.eip = eip;
m.content.dr.most_recent_syscall = most_recent_syscall;
m.content.dr.confirmed = confirmed;
/* pretty print the data race addr to propagate to master program */
char *func;
char *file;
int line;
bool res = symtable_lookup(eip, &func, &file, &line);
if (!res || func == NULL) {
scnprintf(m.content.dr.pretty_printed, MESSAGE_BUF_SIZE,
"0x%.8x <unknown>", eip);
} else if (file == NULL) {
scnprintf(m.content.dr.pretty_printed, MESSAGE_BUF_SIZE,
"0x%.8x in %s <source unknown>", eip, func);
} else {
scnprintf(m.content.dr.pretty_printed, MESSAGE_BUF_SIZE,
"0x%.8x in %s (%s:%d)", eip, func, file, line);
}
if (res) {
if (func != NULL) MM_FREE(func);
if (file != NULL) MM_FREE(file);
}
send(state, &m);
}
开发者ID:Jarvishappy,项目名称:landslide,代码行数:29,代码来源:messaging.c
示例4: log_printf
/**
* @brief Set the number of energy groups for this Material.
* @param num_groups the number of energy groups.
*/
void Material::setNumEnergyGroups(const int num_groups) {
if (num_groups < 0)
log_printf(ERROR, "Unable to set the number of energy groups for "
"material %d to %d", _id, num_groups);
_num_groups = num_groups;
/* Free old data arrays if they were allocated for a previous simulation */
/* If data is vector aligned */
if (_data_aligned) {
if (_sigma_t != NULL)
MM_FREE(_sigma_t);
if (_sigma_s != NULL)
MM_FREE(_sigma_s);
if (_sigma_f != NULL)
MM_FREE(_sigma_f);
if (_nu_sigma_f != NULL)
MM_FREE(_nu_sigma_f);
if (_chi != NULL)
MM_FREE(_chi);
}
/* Data is not vector aligned */
else {
if (_sigma_t != NULL)
delete [] _sigma_t;
if (_sigma_s != NULL)
delete [] _sigma_s;
if (_sigma_f != NULL)
delete [] _sigma_f;
if (_nu_sigma_f != NULL)
delete [] _nu_sigma_f;
if (_chi != NULL)
delete [] _chi;
}
/* Allocate memory for data arrays */
_sigma_t = new FP_PRECISION[_num_groups];
_sigma_f = new FP_PRECISION[_num_groups];
_nu_sigma_f = new FP_PRECISION[_num_groups];
_chi = new FP_PRECISION[_num_groups];
_sigma_s = new FP_PRECISION[_num_groups*_num_groups];
/* Assign the null vector to each data array */
memset(_sigma_t, 0.0, sizeof(FP_PRECISION) * _num_groups);
memset(_sigma_f, 0.0, sizeof(FP_PRECISION) * _num_groups);
memset(_nu_sigma_f, 0.0, sizeof(FP_PRECISION) * _num_groups);
memset(_chi, 0.0, sizeof(FP_PRECISION) * _num_groups);
memset(_sigma_s, 0.0, sizeof(FP_PRECISION) * _num_groups * _num_groups);
}
开发者ID:geogunow,项目名称:OpenMOC,代码行数:64,代码来源:Material.cpp
示例5: MM_FREE
SampleBuffer::~SampleBuffer()
{
if( m_origData != NULL )
MM_FREE( m_origData );
MM_FREE( m_data );
}
开发者ID:DanielAeolusLaude,项目名称:lmms,代码行数:7,代码来源:SampleBuffer.cpp
示例6: MM_FREE
/**
* @brief Allocates memory for FSR source arrays.
* @details Deletes memory for old source arrays if they were allocated for a
* previous simulation.
*/
void VectorizedSolver::initializeSourceArrays() {
/* Delete old sources arrays if they exist */
if (_reduced_sources != NULL)
MM_FREE(_reduced_sources);
if (_fixed_sources != NULL)
MM_FREE(_fixed_sources);
int size = _num_FSRs * _num_groups * sizeof(FP_PRECISION);
/* Allocate aligned memory for all source arrays */
try{
_reduced_sources = (FP_PRECISION*)MM_MALLOC(size, VEC_ALIGNMENT);
_fixed_sources = (FP_PRECISION*)MM_MALLOC(size, VEC_ALIGNMENT);
}
catch(std::exception &e) {
log_printf(ERROR, "Could not allocate memory for FSR sources");
}
/* Initialize fixed sources to zero */
memset(_fixed_sources, 0.0, size);
/* Populate fixed source array with any user-defined sources */
initializeFixedSources();
}
开发者ID:geogunow,项目名称:OpenMOC,代码行数:30,代码来源:VectorizedSolver.cpp
示例7: default
/**
* @brief Computes the total source (fission, scattering, fixed) in each FSR.
* @details This method computes the total source in each FSR based on
* this iteration's current approximation to the scalar flux.
*/
void VectorizedSolver::computeFSRSources() {
#pragma omp parallel default(none)
{
int tid;
Material* material;
FP_PRECISION* sigma_t;
FP_PRECISION* sigma_s;
FP_PRECISION* fiss_mat;
FP_PRECISION scatter_source, fission_source;
int size = _num_groups * sizeof(FP_PRECISION);
FP_PRECISION* fission_sources =
(FP_PRECISION*)MM_MALLOC(size, VEC_ALIGNMENT);
FP_PRECISION* scatter_sources =
(FP_PRECISION*)MM_MALLOC(size, VEC_ALIGNMENT);
/* For all FSRs, find the source */
#pragma omp for schedule(guided)
for (int r=0; r < _num_FSRs; r++) {
tid = omp_get_thread_num();
material = _FSR_materials[r];
sigma_t = material->getSigmaT();
sigma_s = material->getSigmaS();
fiss_mat = material->getFissionMatrix();
/* Compute scatter + fission source for group G */
for (int G=0; G < _num_groups; G++) {
for (int v=0; v < _num_vector_lengths; v++) {
#pragma simd vectorlength(VEC_LENGTH)
for (int g=v*VEC_LENGTH; g < (v+1)*VEC_LENGTH; g++) {
scatter_sources[g] = sigma_s[G*_num_groups+g] * _scalar_flux(r,g);
fission_sources[g] = fiss_mat[G*_num_groups+g] * _scalar_flux(r,g);
}
}
#ifdef SINGLE
scatter_source=cblas_sasum(_num_groups, scatter_sources, 1);
fission_source=cblas_sasum(_num_groups, fission_sources, 1);
#else
scatter_source=cblas_dasum(_num_groups, scatter_sources, 1);
fission_source=cblas_dasum(_num_groups, fission_sources, 1);
#endif
fission_source /= _k_eff;
/* Compute total (scatter+fission+fixed) reduced source */
_reduced_sources(r,G) = _fixed_sources(r,G);
_reduced_sources(r,G) += scatter_source + fission_source;
_reduced_sources(r,G) *= ONE_OVER_FOUR_PI / sigma_t[G];
}
}
MM_FREE(fission_sources);
MM_FREE(scatter_sources);
}
}
开发者ID:geogunow,项目名称:OpenMOC,代码行数:64,代码来源:VectorizedSolver.cpp
示例8: sizeof
/**
* @brief Compute \f$ k_{eff} \f$ from successive fission sources.
*/
void VectorizedSolver::computeKeff() {
FP_PRECISION fission;
int size = _num_FSRs * sizeof(FP_PRECISION);
FP_PRECISION* FSR_rates = (FP_PRECISION*)MM_MALLOC(size, VEC_ALIGNMENT);
size = _num_threads * _num_groups * sizeof(FP_PRECISION);
FP_PRECISION* group_rates = (FP_PRECISION*)MM_MALLOC(size, VEC_ALIGNMENT);
#pragma omp parallel
{
int tid = omp_get_thread_num() * _num_groups;
Material* material;
FP_PRECISION* sigma;
FP_PRECISION volume;
/* Compute the new nu-fission rates in each FSR */
#pragma omp for schedule(guided)
for (int r=0; r < _num_FSRs; r++) {
volume = _FSR_volumes[r];
material = _FSR_materials[r];
sigma = material->getNuSigmaF();
/* Loop over each energy group vector length */
for (int v=0; v < _num_vector_lengths; v++) {
/* Loop over energy groups within this vector */
#pragma simd vectorlength(VEC_LENGTH)
for (int e=v*VEC_LENGTH; e < (v+1)*VEC_LENGTH; e++)
group_rates[tid+e] = sigma[e] * _scalar_flux(r,e);
}
#ifdef SINGLE
FSR_rates[r] = cblas_sasum(_num_groups, &group_rates[tid], 1) * volume;
#else
FSR_rates[r] = cblas_dasum(_num_groups, &group_rates[tid], 1) * volume;
#endif
}
}
/* Reduce new fission rates across FSRs */
#ifdef SINGLE
fission = cblas_sasum(_num_FSRs, FSR_rates, 1);
#else
fission = cblas_dasum(_num_FSRs, FSR_rates, 1);
#endif
_k_eff *= fission;
MM_FREE(FSR_rates);
MM_FREE(group_rates);
}
开发者ID:geogunow,项目名称:OpenMOC,代码行数:58,代码来源:VectorizedSolver.cpp
示例9: MM_FREE
/**
* @brief Destructor deletes Track boundary angular flux and
* and FSR scalar flux and source arrays.
*/
VectorizedSolver::~VectorizedSolver() {
if (_boundary_flux != NULL) {
MM_FREE(_boundary_flux);
_boundary_flux = NULL;
}
if (_boundary_leakage != NULL) {
MM_FREE(_boundary_leakage);
_boundary_leakage = NULL;
}
if (_scalar_flux != NULL) {
MM_FREE(_scalar_flux);
_scalar_flux = NULL;
}
if (_fission_sources != NULL) {
MM_FREE(_fission_sources);
_fission_sources = NULL;
}
if (_scatter_sources != NULL) {
MM_FREE(_scatter_sources);
_scatter_sources = NULL;
}
if (_source != NULL) {
MM_FREE(_source);
_source = NULL;
}
if (_old_source != NULL) {
MM_FREE(_old_source);
_old_source = NULL;
}
if (_reduced_source != NULL) {
MM_FREE(_reduced_source);
_reduced_source = NULL;
}
if (_thread_taus != NULL) {
MM_FREE(_thread_taus);
_thread_taus = NULL;
}
if (_thread_exponentials != NULL) {
MM_FREE(_thread_exponentials);
_thread_exponentials = NULL;
}
}
开发者ID:augusto-vib,项目名称:OpenMOC,代码行数:57,代码来源:VectorizedSolver.cpp
示例10: test_update_state
/* returns true if the state changed. */
bool test_update_state(conf_object_t *cpu, struct test_state *t,
struct sched_state *s)
{
if (anybody_alive(cpu, t, s)) {
if (!t->test_is_running) {
lsprintf(BRANCH, "a test appears to be starting - ");
print_qs(BRANCH, s);
printf(BRANCH, "\n");
t->test_is_running = true;
return true;
}
} else {
if (t->test_is_running) {
lsprintf(BRANCH, "a test appears to be ending - ");
print_qs(BRANCH, s);
printf(BRANCH, "\n");
if (t->current_test) {
MM_FREE(t->current_test);
t->current_test = NULL;
}
t->test_is_running = false;
return true;
}
}
return false;
}
开发者ID:jinlee,项目名称:masters,代码行数:27,代码来源:test.c
示例11: timer_execute
static inline void timer_execute(struct timer *T) {
int idx = T->time & TIME_NEAR_MASK;
while (T->near[idx].head.next) {
struct timer_node *current = link_clear(&T->near[idx]);
UNLOCK(T);
// dispatch_list don't need lock T
do {
struct timer_event * event = (struct timer_event *)(current+1);
T->dispather(event->ud, event->data, event->sz);
struct timer_node * temp = current;
current=current->next;
if(event->period > 0)
{
//update expired
temp->next = NULL;
temp->expire = TI->time + event->period;
add_node(TI, temp );
}
else
{
MM_FREE(temp);
}
} while (current);
LOCK(T);
}
}
开发者ID:jj4jj,项目名称:dcpots,代码行数:29,代码来源:eztimer.cpp
示例12: found_a_bug
void found_a_bug(struct ls_state *ls)
{
if (DECISION_INFO_ONLY == 0) {
lsprintf(BUG, COLOUR_BOLD COLOUR_RED
"**** A bug was found! ****\n");
lsprintf(BUG, COLOUR_BOLD COLOUR_RED
"**** Decision trace follows. ****\n");
} else {
lsprintf(ALWAYS, COLOUR_BOLD COLOUR_GREEN
"(No bug was found.)\n");
}
print_tree_from(ls->save.current, ls->save.next_tid);
char *stack = stack_trace(ls->cpu0, ls->eip, ls->sched.cur_agent->tid);
lsprintf(BUG, "Stack: %s\n", stack);
MM_FREE(stack);
PRINT_TREE_INFO(BUG, ls);
if (BREAK_ON_BUG) {
lsprintf(ALWAYS, COLOUR_BOLD COLOUR_YELLOW
"Now giving you the debug prompt. Good luck!\n");
SIM_break_simulation(NULL);
} else {
SIM_quit(LS_BUG_FOUND);
}
}
开发者ID:jinlee,项目名称:masters,代码行数:28,代码来源:found_a_bug.c
示例13: pluginDestruction
void LadspaEffect::pluginDestruction()
{
if( !isOkay() )
{
return;
}
delete m_controls;
for( ch_cnt_t proc = 0; proc < processorCount(); proc++ )
{
Ladspa2LMMS * manager = Engine::getLADSPAManager();
manager->deactivate( m_key, m_handles[proc] );
manager->cleanup( m_key, m_handles[proc] );
for( int port = 0; port < m_portCount; port++ )
{
port_desc_t * pp = m_ports.at( proc ).at( port );
if( m_inPlaceBroken || pp->rate != CHANNEL_OUT )
{
if( pp->buffer) MM_FREE( pp->buffer );
}
delete pp;
}
m_ports[proc].clear();
}
m_ports.clear();
m_handles.clear();
m_portControls.clear();
}
开发者ID:Penguinum,项目名称:lmms,代码行数:29,代码来源:LadspaEffect.cpp
示例14: FS_Dir_f
/**
* \brief List directories and files.
*/
PRIVATE void FS_Dir_f( void )
{
char *path = NULL;
char findname[1024];
char wildcard[1024] = "*.*";
char **dirnames;
int ndirs;
if ( Cmd_Argc() != 1 )
{
com_strlcpy( wildcard, Cmd_Argv( 1 ), sizeof( wildcard ) );
}
while ( ( path = FS_NextPath( path ) ) != NULL )
{
char *tmp = findname;
com_snprintf( findname, sizeof( findname ), "%s%c%s", path, PATH_SEP, wildcard );
while ( *tmp != 0 )
{
if ( *tmp == '\\' )
*tmp = '/';
tmp++;
}
Com_Printf( "Directory of %s\n", findname );
Com_Printf( "----\n" );
if ( ( dirnames = FS_ListFiles( findname, &ndirs, 0, 0 ) ) != 0 )
{
int i;
for ( i = 0; i < ndirs-1; i++ )
{
if ( strrchr( dirnames[i], PATH_SEP ) )
Com_Printf( "%s\n", strrchr( dirnames[i], PATH_SEP ) + 1 );
else
Com_Printf( "%s\n", dirnames[i] );
MM_FREE( dirnames[i] );
}
MM_FREE( dirnames );
}
Com_Printf( "\n" );
};
}
开发者ID:MichaelLiebscher,项目名称:Wolfenstein3D_Redux,代码行数:49,代码来源:files.c
示例15: PageFile_Shutdown
/**
* \brief Shutdown page cache.
*/
PUBLIC void PageFile_Shutdown( void )
{
if( file_handle_page ) {
fclose( file_handle_page );
file_handle_page = NULL;
}
MM_FREE( PMPages );
}
开发者ID:Oppen,项目名称:WolfExtractor,代码行数:12,代码来源:wolfcore_pm.c
示例16: strlen
/**
* \brief Find texture based on file name
* \param[in] name Name of the texture to find.
* \param[in] type Type of texture (see texturetype_t).
* \return r_notexture if the texture is not found, otherwise it will return a valid texture_t structure.
*/
PUBLIC texture_t *TM_FindTexture( const char *name, texturetype_t type )
{
texture_t *tex;
int i, len;
W8 *data; /* raw texture data */
W16 width, height; /* width, height of texture */
W16 bytes;
if( ! name || ! *name )
{
return r_notexture;
}
// Check for file extension
len = strlen( name );
if( len < 5 )
{
return r_notexture;
}
// look for it in the texture cache
for( i = 0, tex = ttextures; i < numttextures; ++i, ++tex )
{
if( ! strcmp( name, tex->name ) )
{
tex->registration_sequence = texture_registration_sequence;
return tex;
}
}
//
// load the texture from disk
//
data = NULL;
if( ! strcmp( name + len - 4, ".tga" ) )
{
LoadTGA( name, &data, &width, &height, &bytes );
if( ! data )
{
return r_notexture;
}
tex = TM_LoadTexture( name, data, width, height, type, bytes );
}
else
{
return r_notexture;
}
MM_FREE( data );
return tex;
}
开发者ID:Oppen,项目名称:Wolf3DRedux,代码行数:61,代码来源:texture_manager.c
示例17: linkList_deleteFull
/**
* \brief Delete link list and elements.
* \param[in] list Pointer to linkList_t structure.
* \return On success true, otherwise false.
*/
PUBLIC wtBoolean linkList_deleteFull( linkList_t *list )
{
if( list )
{
linkList_t *current;
while( (current = list) )
{
list = list->next;
if( current->element )
{
MM_FREE( current->element );
}
MM_FREE( current );
}
return true;
}
return false;
}
开发者ID:Oppen,项目名称:WolfExtractor,代码行数:26,代码来源:linklist.c
示例18: linkList_quickRemoveNode
/**
* \brief Remove node.
* \param[in] current Node to remove.
* \param[in] previous Previous Node in chain.
* \return On success true, otherwise false.
*/
PUBLIC wtBoolean linkList_quickRemoveNode( linkList_t *current, linkList_t *previous )
{
if( current && previous )
{
previous->next = current->next;
MM_FREE( current );
return true;
}
return false;
}
开发者ID:Oppen,项目名称:WolfExtractor,代码行数:18,代码来源:linklist.c
示例19: DecodeText
PRIVATE void DecodeText( W16 version )
{
char *text;
int artnum;
int endextern;
int i;
int length;
FILE *fhandle;
int limit;
limit = 6;
if( version & SOD_PAK )
{
endextern = 168;
fhandle = fopen( "sod.txt", "wb" );
if( ! fhandle )
{
return;
}
limit = 1;
}
else if( version & WL6_PAK )
{
endextern = 143;
fhandle = fopen( "wl6.txt", "wb" );
if( ! fhandle )
{
return;
}
}
else
{
return;
}
for( i = 0 ; i < limit ; ++i )
{
artnum = endextern + i;
CA_CacheGrChunk( artnum, version );
text = (char *)grsegs[ artnum ];
length = strlen( text );
fwrite( text, sizeof( W8 ), length, fhandle );
fprintf( fhandle, "\n\n" );
MM_FREE( grsegs[ artnum ] );
}
fclose( fhandle );
}
开发者ID:QuinnEbert,项目名称:Wolf3D-iOS,代码行数:53,代码来源:wolf_gfx.c
示例20: AudioFile_Shutdown
/**
* \brief Shutdown audio decoder.
* \return Nothing.
*/
PUBLIC void AudioFile_Shutdown( void )
{
if( audiohandle )
{
fclose( audiohandle );
audiohandle = NULL;
}
if( audiostarts )
{
MM_FREE( audiostarts );
}
}
开发者ID:MichaelLiebscher,项目名称:Wolfenstein3D_Redux,代码行数:17,代码来源:wolfcore_audio.c
注:本文中的MM_FREE函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论