Ignore:
Timestamp:
May 24, 2017, 12:06:43 PM (2 years ago)
Author:
nmedfort
Message:

Eliminated ExecutionEngine? memory leak. Intentionally broke compatibility with prior versions to ensure unchecked in projects are restructured.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/editd/editd.cpp

    r5464 r5474  
    237237    idb->CreateRetVoid();
    238238
    239     pxDriver.linkAndFinalize();
     239    pxDriver.finalizeObject();
    240240}
    241241
     
    309309    iBuilder->CreateRetVoid();
    310310
    311     pxDriver.linkAndFinalize();
     311    pxDriver.finalizeObject();
    312312}
    313313
     
    315315typedef void (*preprocessFunctionType)(const int fd, char * output_data);
    316316
    317 preprocessFunctionType preprocessCodeGen() {
    318     ParabixDriver pxDriver("preprocess");
    319     preprocessPipeline(pxDriver);
    320     return reinterpret_cast<preprocessFunctionType>(pxDriver.getPointerToMain());
    321 }
    322 
    323317typedef void (*editdFunctionType)(char * byte_data, size_t filesize);
    324 
    325 editdFunctionType editdCodeGen(const std::vector<std::string> & patterns) {
    326     ParabixDriver pxDriver("editd");
    327     editdPipeline(pxDriver, patterns);
    328     return reinterpret_cast<editdFunctionType>(pxDriver.getPointerToMain());
    329 }
    330318
    331319static char * chStream;
     
    373361
    374362    while (groupIdx < pattGroups.size()){
    375         editdFunctionType editd_ptr = editdCodeGen(pattGroups[groupIdx]);
     363
     364        ParabixDriver pxDriver("editd");
     365        editdPipeline(pxDriver, pattGroups[groupIdx]);
     366        auto editd_ptr = reinterpret_cast<editdFunctionType>(pxDriver.getMain());
    376367        editd(editd_ptr, chStream, size);
    377368
     
    601592#endif
    602593
    603     preprocessFunctionType preprocess_ptr = preprocessCodeGen();
     594    ParabixDriver pxDriver("preprocess");
     595    preprocessPipeline(pxDriver);
     596    auto preprocess_ptr = reinterpret_cast<preprocessFunctionType>(pxDriver.getMain());
    604597    preprocess(preprocess_ptr);
    605598
     
    632625
    633626    if(pattVector.size() == 1){
    634         editdFunctionType editd_ptr = editdCodeGen(pattVector);
     627
     628        ParabixDriver pxDriver("editd");
     629        editdPipeline(pxDriver, pattVector);
     630        auto editd_ptr = reinterpret_cast<editdFunctionType>(pxDriver.getMain());
    635631        editd(editd_ptr, chStream, size);
    636632    }
     
    638634        if (Threads == 1) {
    639635            for(unsigned i=0; i<pattGroups.size(); i++){
    640                 editdFunctionType editd_ptr = editdCodeGen(pattGroups[i]);
     636
     637                ParabixDriver pxDriver("editd");
     638                editdPipeline(pxDriver, pattGroups[i]);
     639                auto editd_ptr = reinterpret_cast<editdFunctionType>(pxDriver.getMain());
    641640                editd(editd_ptr, chStream, size);
    642641            }
Note: See TracChangeset for help on using the changeset viewer.