Changeset 300

Show
Ignore:
Timestamp:
04/22/08 20:27:25 (9 months ago)
Author:
h3r3tic
Message:

more memory usage reductions

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/ddl/FileBuffer.d

    r287 r300  
    6767        (new File(this.path)).write(this.data); 
    6868    } 
     69     
     70    void deleteData() { 
     71        delete this.data; 
     72    } 
    6973} 
  • trunk/ddl/omf/OMFLoader.d

    r287 r300  
    5555    public DynamicLibrary load(LoaderRegistry registry,FileBuffer file){ 
    5656        debug debugLog("loading OMF library");       
    57         return new OMFLibrary(file); 
     57        auto res = new OMFLibrary(file); 
     58        file.deleteData(); 
     59        return res; 
    5860    } 
    5961} 
     
    8082        OMFLibrary lib = new OMFLibrary(); 
    8183        OMFModule mod = new OMFModule(file); 
     84        file.deleteData(); 
     85         
    8286        lib.addModule(mod); 
    8387                 
  • trunk/ddl/omf/OMFModule.d

    r299 r300  
    203203                                 
    204204        //TODO: alter this to zero in on D namespaces and C/asm namespaces 
    205         this.moduleName = binary.libraryName
     205        this.moduleName = binary.libraryName.dup
    206206        this.moduleName = Text.replace(this.moduleName,'\\','.'); 
    207207        //debug debugLog(moduleName); 
     
    469469        } 
    470470         
     471        // Pack all symbol names together into a new buffer 
     472         
     473        char[] symNamesBuffer; 
     474        size_t totalSymNameLength = 0; 
     475        foreach (sym; symbols) { 
     476            totalSymNameLength += sym.name.length; 
     477        } 
     478         
     479        symNamesBuffer.length = totalSymNameLength; 
     480        size_t curSymNameLength = 0; 
     481        foreach (ref sym; symbols) { 
     482            char[] name2 = symNamesBuffer[curSymNameLength .. curSymNameLength + sym.name.length]; 
     483            curSymNameLength += sym.name.length; 
     484            name2[] = sym.name[]; 
     485            sym.name = name2; 
     486        } 
     487         
    471488        //printf("%.*s"\n, toString); 
    472489    }