H
hachuah
Hi,
I'm trying to use MLDBM on an object I've written in Perl, and cannot
get it to work right. Here's my problem:
I'm trying to parse a file, and build a data structure in memory that
will enable me to easily make transformations, and then write the file
back out. I'm using OOP to do this. My object consists of:
in Bigobject.pm
$self->{hash1} = \%hash1 (multidimensional hash);
where $hash1{$a}{$b} = \$a_dag_node
$self->{hash2} = \%hash2 (multidimensional hash);
where $hash2{$c}{$d} = \$another_dag_node
$self->{rootnode} - Points to tree of DAG_Nodes. (from DAG_Node.pm)
in main.pl
$bo = Bigobject->new(); $bo->parse("$file");
Now, the problem is that I'm running out-of-memory while building this
object; therefore, I'm trying to use MLDBM to put all or part of it on
disk. I've tried the following, and it doesn't work (memory usage is
still huge):
-----1----------------------
in main.pl
use MLDBM; # this gets SDBM and Data:umper
use Fcntl; # to get 'em constants
$dbm = tie %bo, 'MLDBM', 'testmldbm', O_CREAT|O_RDWR, 0640 or die $!;
$bo{1} = Bigobject->new(); $bo{1}->parse("$file");
-----2----------------------
in Bigobject.pm
sub parse {
<snip>
use MLDBM; # this gets SDBM and Data:umper
use Fcntl; # to get 'em constants
$dbm = tie %hash1, 'MLDBM', 'testmldbm', O_CREAT|O_RDWR, 0640 or die
$!;
$self->{hash1} = \%hash1;
<...>
$hash1{$a}{$b} = $pointer_to_dag_node
Anyone have any ideas?
thanks,
hachuah
I'm trying to use MLDBM on an object I've written in Perl, and cannot
get it to work right. Here's my problem:
I'm trying to parse a file, and build a data structure in memory that
will enable me to easily make transformations, and then write the file
back out. I'm using OOP to do this. My object consists of:
in Bigobject.pm
$self->{hash1} = \%hash1 (multidimensional hash);
where $hash1{$a}{$b} = \$a_dag_node
$self->{hash2} = \%hash2 (multidimensional hash);
where $hash2{$c}{$d} = \$another_dag_node
$self->{rootnode} - Points to tree of DAG_Nodes. (from DAG_Node.pm)
in main.pl
$bo = Bigobject->new(); $bo->parse("$file");
Now, the problem is that I'm running out-of-memory while building this
object; therefore, I'm trying to use MLDBM to put all or part of it on
disk. I've tried the following, and it doesn't work (memory usage is
still huge):
-----1----------------------
in main.pl
use MLDBM; # this gets SDBM and Data:umper
use Fcntl; # to get 'em constants
$dbm = tie %bo, 'MLDBM', 'testmldbm', O_CREAT|O_RDWR, 0640 or die $!;
$bo{1} = Bigobject->new(); $bo{1}->parse("$file");
-----2----------------------
in Bigobject.pm
sub parse {
<snip>
use MLDBM; # this gets SDBM and Data:umper
use Fcntl; # to get 'em constants
$dbm = tie %hash1, 'MLDBM', 'testmldbm', O_CREAT|O_RDWR, 0640 or die
$!;
$self->{hash1} = \%hash1;
<...>
$hash1{$a}{$b} = $pointer_to_dag_node
Anyone have any ideas?
thanks,
hachuah