Add some free
This commit is contained in:
parent
84cf48c37e
commit
faa7e072b5
5
main.c
5
main.c
@ -49,6 +49,9 @@ int main() {
|
|||||||
|
|
||||||
distribute_text();
|
distribute_text();
|
||||||
|
|
||||||
|
if (rank == MASTER)
|
||||||
|
free(text);
|
||||||
|
|
||||||
//printf("%d -> input: %s\n", rank, private_text);
|
//printf("%d -> input: %s\n", rank, private_text);
|
||||||
//printf("%d -> text len: %d\n", rank, private_text_len);
|
//printf("%d -> text len: %d\n", rank, private_text_len);
|
||||||
|
|
||||||
@ -66,6 +69,8 @@ int main() {
|
|||||||
|
|
||||||
search_for_splitted_pattern(&residue, &match_number, &matches);
|
search_for_splitted_pattern(&residue, &match_number, &matches);
|
||||||
|
|
||||||
|
free(private_text);
|
||||||
|
|
||||||
calculate_absolute_indices(match_number, matches);
|
calculate_absolute_indices(match_number, matches);
|
||||||
|
|
||||||
//printf("%d -> result number: %d\n", rank, match_number);
|
//printf("%d -> result number: %d\n", rank, match_number);
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
#include "kmp.h"
|
#include "kmp.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <papi.h>
|
#include <papi.h>
|
||||||
|
#include <malloc.h>
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
int text_len, pattern_len;
|
int text_len, pattern_len;
|
||||||
@ -18,6 +19,7 @@ int main() {
|
|||||||
|
|
||||||
long_long start_search = PAPI_get_real_usec();
|
long_long start_search = PAPI_get_real_usec();
|
||||||
int *matches = search_pattern(text, pattern, lps, &match_number, &residue);
|
int *matches = search_pattern(text, pattern, lps, &match_number, &residue);
|
||||||
|
free(text);
|
||||||
long_long end_time = PAPI_get_real_usec();
|
long_long end_time = PAPI_get_real_usec();
|
||||||
|
|
||||||
printf("found %d matches\n", match_number);
|
printf("found %d matches\n", match_number);
|
||||||
|
Loading…
Reference in New Issue
Block a user