On Thu, 29.07.10 16:42, Nikunj A. Dadhania ([email protected]) wrote:
> > On Thu, 29 Jul 2010 15:38:17 +0530, Balbir Singh <[email protected]> > wrote: > > * Nikunj A. Dadhania <[email protected]> [2010-07-29 11:24:05]: > > > > > > sizeof(struct cgroup_context_s) returns 820408 bytes. Is this really > > > intended? > > > > > > > wow! that is huge, can you please break that down? > > FILENAME_MAX is 4096 bytes, I am using a 64bit system. > > struct cg_mount_table_s { > char name[FILENAME_MAX]; > char path[FILENAME_MAX]; > int index; > }; This is evil. Friends don't let friends use FILE_NAME_MAX like this. Just allocate strings with strdup() like everybody else does. Preallocating huge blobs of memory that way is not nice. We live in a dynamic world, you should size your variables dynamically. i.e. the struct above shoudl just use "char *name" and "char *path" and those strings should be allocated independently with strdup. Lennart -- Lennart Poettering - Red Hat, Inc. ------------------------------------------------------------------------------ This SF.net email is sponsored by Make an app they can't live without Enter the BlackBerry Developer Challenge http://p.sf.net/sfu/RIM-dev2dev _______________________________________________ Libcg-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/libcg-devel
