I was this person. Most people who do this are what people would usually call travelers. People who do it voluntarily, like I did, usually had enough money to get to another interesting place or buy a meal anytime they are hungry. Many people have odd jobs in remote places that preclude housing (I have had these jobs too). Some people are also begging as they travel. I never begged. I worked whenever I needed money. Generally speaking, living like this without facing extreme difficulties is exclusively a white male privilege from a country with a strong passport. Non-white people are routinely arrested. Women are routinely raped. Weak passports get deported.
Non-consecutively I spent a little over 4 years living in a tent or on the ground in some capacity. The longest period of time I lived exclusively in a tent was 14 months consecutively.
I hiked backcountry trails, city streets and traveled extensively through a number of countries. I rode a bicycle for some of those years as well. In total I walked somewhere around 1500-2000 miles and rode between 3000 and 4000 miles. The farthest I have ever walked in a single day is 30 miles. The farthest I have ever cycled in a single day is just over 120 miles. The longest period of time I spent in a single national forest was 5 months, but I worked in the back country there for 3 of them so I don’t know how to count that. There are thousands of people who work in the back country for many many months on end doing things like trail maintenance throughout the US.
I too have forgotten to memset my structs in c++ tensorflow after prototyping in python.