diff --git a/NHF/include/proc_test.h b/NHF/include/proc_test.h index 1d5fbc3eed4867b1866c34ad4d80497483c4ed29..ef22d5a9d8fa37f5bc41329340e901ee2ea74a75 100644 --- a/NHF/include/proc_test.h +++ b/NHF/include/proc_test.h @@ -28,7 +28,7 @@ class proc_test : public process void operator=(const proc_test&); std::string get_name() { return name; } proc_test* get_next() { return next; } - ~proc_test(){this->kill();} +// ~proc_test(){this->kill();} private: std::string name;/**< A process neve */ proc_test* next;/**< A következő listaelemre mutató pointer */ diff --git a/NHF/main.cpp b/NHF/main.cpp index 03cc32418c42e218ee78ae9847741a4fe38bb396..10b6478b08124724e2ead26a312b128848f76ccf 100644 --- a/NHF/main.cpp +++ b/NHF/main.cpp @@ -8,7 +8,7 @@ using namespace std; #ifdef DEBUG - ifstream fin("/home/mate/Dropbox/Egyetem/Tárgyak/2015 tavasz/Programozás alapjai 2/NHF/NHF/tests/test_2"); + ifstream fin("/home/mate/Dropbox/Egyetem/Tárgyak/2015 tavasz/Programozás alapjai 2/NHF/NHF/tests/test_1"); #define cin fin #endif // DEBUG @@ -45,12 +45,14 @@ int main() case '+': try { - cout<<"Adding process of name '"<<request.name<<"' and size of blocks "<<request.block_size<<".\n"; - procs.add(new proc_test(request.name,process(mem),request.block_size)); break; + cout<<"Adding process of name '"<<request.name<<"' and of size "<<request.block_size<<".\n"; + procs.add(new proc_test(request.name,process(mem),request.block_size)); + break; } catch(domain_error& err) { cerr<<err.what()<<" "<<"A(z) '"<<request.name<<"'processz beszúrása meghiúsult."<<endl; + break; } case '-': cout<<"Killing process of name '"<<request.name<<"'.\n"; @@ -68,7 +70,6 @@ int main() { cerr<<err<<endl; } - #ifdef DEBUG fin.close(); #endif // DEBUG diff --git a/NHF/src/heap.cpp b/NHF/src/heap.cpp index 9879b1d546a8343cc78b69509581d11372008221..0bfd24d5d3210d753ca97d5cb2b6ea50d59acbf6 100644 --- a/NHF/src/heap.cpp +++ b/NHF/src/heap.cpp @@ -68,7 +68,7 @@ void heap::free(const memnum pid) throw (invalid_pid("A hivatkozott blokk már üres.")); else if(blocks[pid].filled && blocks[pid].block_size==0) throw (invalid_pid("Ezen a címen nem kezdődik memóriablokk")); - memnum next_block_idx=pid+blocks[pid].block_size; + memnum next_block_idx=pid+blocks[pid].block_size-1; for(memnum i=pid+1; i<next_block_idx; i++) blocks[i].reset(); /* diff --git a/NHF/src/test_container.cpp b/NHF/src/test_container.cpp index bae0a920bf8703fc8bb4d10ba2138da41ca452ff..265d9afa5ad0a04d5a4500a7faa4f4ffbb70a329 100644 --- a/NHF/src/test_container.cpp +++ b/NHF/src/test_container.cpp @@ -8,6 +8,7 @@ void test_container::kill(const std::string& name) { k=list_head; list_head=list_head->next; + k->kill(); delete k; return; } @@ -17,6 +18,7 @@ void test_container::kill(const std::string& name) if(k==NULL) throw (std::invalid_argument("Érvénytelen processnév")); i->next=k->next; + k->kill(); delete k; } diff --git a/NHF/tests/test_2 b/NHF/tests/test_2 index 28ac2516a7637e531d0554282d5c766d8eac9466..ebd8894b3daefa2bf7aa5cdd922b82efa03d4720 100644 --- a/NHF/tests/test_2 +++ b/NHF/tests/test_2 @@ -5,5 +5,5 @@ # + windows 5001 # -+linux 533 ++ linux 533 # diff --git a/NHF/tests/test_5 b/NHF/tests/test_5 new file mode 100644 index 0000000000000000000000000000000000000000..81c7d2c1d8b6981d79800e5566f314cee4b98227 --- /dev/null +++ b/NHF/tests/test_5 @@ -0,0 +1,7 @@ +100 ++ pidgin 10 ++ awesome 5 ++ i3 1 +# +- awesome +#