chris@mimsy.UUCP (Chris Torek) (05/24/88)
>In article <13100010@bucc2> brian@bucc2.UUCP writes: >>... After a call to malloc is made, a mark() function can be called >>to set a code in this field. Later, a function called free_group() >>frees all the blocks with a specific code. ... In article <5482@bloom-beacon.MIT.EDU> raeburn@athena.mit.edu (Ken Raeburn) writes: >How about combining these steps? ... > area create_area (void); > void * allocate (size_t size, area a); > void release (void * ptr); > void free_area (area a); This seems a much nicer interface. I would suggest that if you wanted something like `programmer' and `project' fields, that you augment it to, e.g., area a_create(char *identifier); void *a_alloc(size_t size, area a); void a_free1(void *ptr); void a_freeall(area a); The `identifier' would merely be stored somewhere for debugging purposes: void a_snapshot(FILE *outf); ... a_snapshot(stderr); might produce a list of all allocated blocks, their sizes, and their identifiers. If you decide it would be worthwhile, it would be easy enough to add a `find named area' routine: area a_find(char *identifier); which would make freeing someone else's trash easier: a_freeall(a_find("jow bloe/lawnmower data")); -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163) Domain: chris@mimsy.umd.edu Path: uunet!mimsy!chris