Analysis of experimental data on longevity and fertility of females of Mediterranean fruit fly Ceratitis capitata demonstrates that flies lay fewer eggs on the average as the average life-span increases. At the same time, the values of individual life-span and the number of eggs laid are positively correlated. To explain these results, a resource model describing the allocation and reallocation of resources between two basic functions, reproduction and maintenance, was proposed. The reallocation of resources, is triggered by changes in environmental conditions such as diet changes, and the parameters of reallocation depend on the current environmental conditions. Modeling demonstrated that the results of experiments are greatly influenced by population selection and heterogeneity.