Skip to content

Commit

Permalink
Possible speedup for requesting sie file #1555
Browse files Browse the repository at this point in the history
The mac won't allow me to declare a "char buff[1000001];".  It compiles
but throws an exception when run.  Changed it to "char *buff = new char[1000001];"
  • Loading branch information
alexlin0 committed Sep 14, 2023
1 parent a2486fc commit 0999387
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions trick_source/sim_services/Sie/Sie.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,14 +181,14 @@ void Trick::Sie::sie_append_runtime_objs() {
}

std::string sie_filename = get_runtime_sie_dir() + "/" + "S_sie.resource" ;

sie_out.open(sie_filename.c_str(), std::fstream::in | std::fstream::out) ;

const char * comment = "<!--\nRuntime Allocations\nDo not edit this comment or file content past this point\n-->\n";
int comment_len = strlen(comment);

int curr_offset = 1;
int mem_size = 1000000;
char buff[mem_size + 1];
char * buff = new char[mem_size + 1];
char * find_str = NULL;

// initial read use the whole buffer
Expand All @@ -206,6 +206,7 @@ void Trick::Sie::sie_append_runtime_objs() {

if ( !find_str ) {
std::cerr << "Warning: Cannot add runtime/dynamic allocations to S_sie.resource. S_sie.resource is corrupted, outdated, or missing. Please be sure that SIM_*/S_sie.resource is preserved after build time if needed at runtime for trick-tv or other variable server clients. Please also rerun trick-CP." << std::endl;
delete[] buff;
return;
}

Expand All @@ -217,6 +218,7 @@ void Trick::Sie::sie_append_runtime_objs() {
runtime_objects_print(sie_out);
sie_out << "</sie>\n";
sie_out.close();
delete[] buff;
}

std::string Trick::Sie::get_runtime_sie_dir() {
Expand Down

0 comments on commit 0999387

Please sign in to comment.