----- Original Message ----- From: "Shane Corgatelli" <[EMAIL PROTECTED]>
I can't get this to compile with the amendment you supplied (haven't tried without it). Compilation eventually consumes all memory, and is so cpu-intensive that it's difficult to even kill. Anyway, some observations are interspersed amongst the code below. Hope they help .... though they didn't help me to get it to compile. Even a deliberately inserted error didn't crash the compilation. > void _init_values( SV* obj, SV* col_vals ) { > HV* hash; > HE* hash_entry; > SV* sv_key; > SV* sv_val; > HV* members = SvRV(obj); > SV* sv_new_key = newSVpv( "_col_", 5 ); > char* key; Shouldn't you allocate (and free) memory for 'key' somewhere in the program ? (See 'New' and 'Safefree' in perldoc perlapi). Perhaps this is where the memory leak arises. If you don't allocate the memory it seems that it gets allocated for you, but I wouldn't guarantee that the memory is automatically freed for you. > int num_keys, i; > STRLEN keylen; > I can't see anywhere where a value is assigned to 'keylen'. Not sure of the ramifications of that. > hash = (HV*)SvRV( col_vals ); > num_keys = hv_iterinit( hash ); > for ( i = 0; i < num_keys; i++ ) { > hash_entry = hv_iternext( hash ); > sv_key = hv_iterkeysv( hash_entry ); > sv_val = hv_iterval( hash, hash_entry ); > > sv_setpvn( sv_new_key, "_col_", 5 ); > sv_catsv( sv_new_key, sv_key ); > key = SvPV( sv_new_key, keylen ); > > hv_store( members, key, keylen, sv_val, 0 ); > } > hv_iterinit( hash ); > return; I don't know what effect 'return;' would have in a 'void' function. I would delete it (unless you know of some valid reason that it be included). > } > > perl => sub { $perl_d->_init_values_perl( $t ) }, > inline => sub { $inline_d->_init_values( $t ) } Strikes me as odd that you're only supplying one argument (ie $t) to the functions, whereas they're expecting 2 arguments. As you can see, I can't really help in any significant way. If no-one here provides more useful help then you might have to look at starting simpler and working up. Also check out 'perldoc Inline::C-Cookbook' if you haven't already. It may contain something useful to you. Cheers, Rob