35 void exec(
const char* cmd,
char *
buffer,
size_t length);
43 int main(
int argc,
char **argv)
63 const int immediatelyFree = 0;
66 int sizePerBuf = 1024 * 1024;
68 char** bufs = (
char**) malloc(numBufs *
sizeof(
char*));
70 for (
int i = 0; i < numBufs; i++)
74 printf(
"after alloc: ");
81 printf(
"after free: ");
86 printf(
"deleting memory:\n");
89 for (
int i = 0; i < numBufs; i++)
94 printf(
"after free: ");
109 printf(
"Iteration %d) - currently used memory amount: ", i);
117 strncpy(buffer,
"ERROR", length);
119 if ( (pipe = popen(cmd,
"r")) ==
NULL )
122 while (fgets(buffer, length, pipe) !=
NULL);
130 char result[128] = { 0 };
131 char command[128] = { 0 };
133 snprintf(command,
sizeof(command),
"pmap %d | grep total", getpid());
135 exec(command, result,
sizeof(result));
137 printf(
"%s", result);
142 char* buf = (
char*) malloc(size *
sizeof(
char));
143 for (
int i = 0; i < 1; i++)
int main(int argc, char **argv)
void exec(const char *cmd, char *buffer, size_t length)
DltReturnValue dlt_free(void)
unsigned char buffer[BUFFER_SIZE]
Buffer for dlt file transfer. The size is defined by BUFFER_SIZE.
DltReturnValue dlt_init(void)
char * occupyMemory(uint size)