On Wed, Dec 4, 2013 at 2:59 PM, David Buchan <pdbuc...@yahoo.com> wrote: > // Allocate memory on the heap, not stack. > msgdata = (msgdatas *) malloc (1 * sizeof (msgdatas)); > msgdata->textview = (int *) malloc (1 * sizeof (int)); > message = (char *) malloc (1024);
The only blocks of memory that need to be on the heap are those that will be passed around. These ones don't go anywhere, so they could be automatic (ie on the stack). If it helps, think of every block of memory as having an owner. When you call strdup() or malloc() or anything like that, you get a pointer to a block of memory which you now own. You can then pass that pointer to another thread and abandon it, and the other thread now owns that memory. Ultimately, the owner of the memory frees it, and then nobody owns it. ChrisA _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list